[uae] Re: Clock fixes

Hi Richard,

Richard Drummond <evilrich@xxxxxxxxxxxxxx> wrote:
> On Wednesday 28 July 2004 03:29 am, Axel Dörfler wrote:
> > At least BeOS don't have a timegm() function, and it's sure not 
> > POSIX
> > compliant.
> > What does it do?
> I suspected this might be a problem. 
> 
> timegm is a BSD and GNU function. It converts a time in struct tm 
> format to a 
> time in seconds without adding any timezone offset.

So it's the counterpart to gmtime(). Great name ;-)

> What I'm trying to do is find the timezone offset. The problem is 
> that the 
> time-stamp on a file returned by the stat() function is in UTC, while 
> the 

Is that so? I would think that it would return the time in the native 
time format, which can be either UTC or your local time. But I am not 
really sure about it, either; that's something that has always confused 
me (because it's handled differently across the different OSes).

> Amiga needs a timestamp in the local timezone. The timezone_r() and 
> timegm() 
> pair in the the get_time() patch take care of this.

I don't have a good idea here, but maybe you can use localtime_r() in a 
useful way :)
(I don't remember from which value you want to conver).
"tm_gmtoff" should be usable, too, then.

> Another alternative would be to call tzset() and use the global 
> variable 
> timezone offset (which should be the offset in seconds) directly. The 
> timezone global is a SYSV addition, however, so is also not POSIX 
> compliant.

Right, but although BeOS has it, I am unsure about AmigaOS and Windows 
(and would think presumably not).

Bye,
   Axel.


Other related posts: