Re: gettimeofday()

Keith Rohrer (kwrohrer@uiuc.edu)
Tue, 29 Jul 1997 15:51:54 -0500


Geis Jerry wrote:
> I am attempting to use the function gettimeofday() to tell me
> the current time in different time zones based on minuteswest
> of GMT.
>
> when calling the getttimeofday with tz_minuteswest of (0 and 5*60)
> I seem to be getting the same value?
>
> tz.tz_dsttime = DST_USA;
> tz.tz_minuteswest = 5*60;
> gettimeofday(&tv, &tz);
>
> I have two questions?
> 1) is there a better way to get current time in different time zones?
> 2) Is there something I am missing in calling gettimeofday() that it
> is not picking up the 5*60 minuteswest as being different than 0
> minuteswest.
>From reading the man page for gettimeofday, my impression is that both
tv and tz are output-only parameters, passed by pointer. My best
suggestion would be to inspect the tz that is returned, and add the
appropriate difference to tv.tv_sec...

Keith

-- 
The wisdom of G'Kar:
Bad Guys make a very satisfying THUMP when they hit the
ground.  But to thump the book of G'Quan is disrespectful.