Mac OS date command - getting higher temporal resolution
I am trying to use the date command in Terminal on multiple Mac OS X machines that are synced via NTP to synchronize some code in a program. Essentially I am running a program...
MyProgram with arguments[date]
I can get date to give me the seconds since the Unix epoch with the %M specifier.
When I try to use %N to get nanosecond resolution, date just returns N. Is there anyway to get date to give me finer then second resolution? I wouldn't even mind passing two arguments such as
(date +%M):arg2
And then converting units in the program.
Many thanks in advance!
%N specifier listed here: htt开发者_运维知识库p://en.wikipedia.org/wiki/Date_(Unix)
Per man date
on Mac OS X 10.5, date
on MacOSX doesn't appear to go beyond seconds-resolution. You can get fractions of a second with other included tools such as Python or Perl, e.g.
$ python -c'import time; print repr(time.time())'
1269148775.3234861
精彩评论