Current system time as a Timestamp
조회 수: 791 (최근 30일)
I want to get the current system time in microseconds and share this timestamp with other computer via UDP. How to do that. fprintf('This message is sent at time %f', time) Is something like above possible in matlab? Please help me with this.
추가 답변 (4개)
Jan 2016년 1월 21일
A timestamp with a precision of microseconds is not meaningful, when the command to obtain the timestamp needs more than a microsecond. Then it is not exactly defined if the stamp belongs to the time before or after the command.
Peter Perkins 2019년 3월 25일
This is an old post the got reopened. I feel compelled to say that in anything like recent versions of MATLAB, datetime('now') is much preferred over now.
On Windows, the clock function and datetime('now') both return a system time rounded to milliseconds. On Linux or Mac, it's rounded to microseconds. Whether or not either of those is actually accurate or not depends entirely on your system though.