Re: gettimeofday() seems to return local time
Re: gettimeofday() seems to return local time
- Subject: Re: gettimeofday() seems to return local time
- From: Justin Walker <email@hidden>
- Date: Thu, 2 Dec 2004 08:36:48 -0800
On Dec 2, 2004, at 4:09, email@hidden wrote:
On Wed, Dec 01, 2004 at 03:39:14PM -0800, Justin Walker wrote:
On Dec 1, 2004, at 14:57, Michael Rubinstein wrote:
I'm using gettimeofday(), on OS X 10.3.6, to get the time resolution
I
need (milliseconds).
If I'm reading the documentation right, I should be getting time in
UTC. However, I'm getting local time.
As I read the man page, you should get the local time in *tp, and the
offset from UTC in *tzp.
Should gettimeofday() return local time?
Yup.
Hm, my reading of the Solaris, Linux and Mac OS X man pages is that the
time returned should indeed be UTC ... the former two explicitly
mention UTC, the Mac OS X page speaks of "current Greenwich time",
which
I would interpret as "old" UTC.
I don't think you are reading it correctly. The man page does mention
"current Greenwich time", as you say, but in more detail:
The system's notion of the current Greenwich time and the current
time
zone is obtained with the gettimeofday() call, and set with the
settimeofday() call. The time is expressed in seconds and
microseconds
which I take to mean that you can get either. If you include a
non-null *tzp, you get the local time, with the tz struct giving you
the offset (from UTC/Greenwich).
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | It's not whether you win or
lose...
| It's whether *I* win or lose.
*--------------------------------------*-------------------------------*
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden