RE: gettimeofday() seems to return local time
RE: gettimeofday() seems to return local time
- Subject: RE: gettimeofday() seems to return local time
- From: "Michael Rubinstein" <email@hidden>
- Date: Fri, 3 Dec 2004 13:19:57 -0500
- Importance: Normal
Noah and group,
You're right, it does return UTC.
You're also right about why I thought I was getting local time.
I was "doing something stupid when you determine what time those
seconds represent".
I really appreciate everyone's help. Sorry about the incorrect
report.
Michael
>-----Original Message-----
>From: noah williamsson [mailto:email@hidden]
>Sent: Friday, December 03, 2004 11:18 AM
>To: Michael Rubinstein
>Cc: email@hidden
>Subject: Re: gettimeofday() seems to return local time
>
>
>Hi Michael,
>
>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.
>
>Gettimeofday() with NULL as second argument always returns
>time in UTC.
>If it does not, either the clock and timezone on your
>machine is wrong
>or you're doing something stupid when you determine what time those
>seconds represent. Like using ctime() for example, which
>prints the time
>according to the local timezone.
>
>
>The man page for gettimeofday() on 10.3.6 also says this about the
>second argument:
> "Note: timezone is no longer used; this information is
>kept outside
> the kernel."
>I assume they want you to use tzset() and functions from
>time.h instead.
>
>
>On a sidenote, there was a bug before 10.3 where chrooted processes
>weren't able to determine the local time correctly even
>though tzset()
>had been used prior to the call to chroot().
>
>
> -- noah
>
_______________________________________________
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