lkml.org 
[lkml]   [1997]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: gettimeofday()
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.

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.044 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site