Re: UTC time with milliseconds
Re: UTC time with milliseconds
- Subject: Re: UTC time with milliseconds
- From: Doug McNutt <email@hidden>
- Date: Mon, 23 Feb 2015 17:03:53 -0500
On 02/23/2015 03:27 PM, Jörgen Stahle wrote:
Hi there
Does anyone know a nice way to get UTC time with milliseconds?
What I would like is a timestamp like this: 2015-02-23T20:56:31.471
It would be nice to use
*do shell script*"date -u '+%Y-%m-%dT%H:%M:%S.%N’"
- but the ”N” in that command does not work in BSD, as in other Unix
systems. It returns "2015-02-23T20:26:10.N"
Is there another way. For example by using Objective-C?
<http://www.nist.gov/pml/div688/grp40/tmas.cfm>
would be a good place to start. You're going to discover that
milliseconds accuracy will require some personal hardware that
synchronizes a local clock that will not be a computer.
The speed of light is about a foot per nanosecond. Absolute timing using
the internet will likely never be as good as one second especially when
Applescript is involved.
There has been some effort to make UNIX time words in the form of two
integers. One is the usual seconds and the other is microseconds but
it's useful only for local time differences as you might use for timing
execution of a subroutine.
How about a random number generator to get three digits? Personally I
would use perl to format whatever you want as a dot and three digits
after the time value. There is a UNIX tool "time" which is a bit like
data. Try a "man time" command in a shell.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden