[tz] Adapting localtime.c

Random832 random832 at fastmail.com
Sat Oct 8 18:03:53 UTC 2016

On Sat, Oct 8, 2016, at 13:27, Carsten Larsen wrote:
> Hello list
> I am trying to adapt the tz code to a local system without any timezone 
> database (AmigaOS). I got the code up and running and everything seems 
> to work as intended. But one thing about the code puzzles me.
> I need to implement "time_t time(time_t *p)" which is the very last part 
> of localtime.c. Should this code return time as local time or as GMT 
> time ? Because I cannot get the time calculations to work properly.

This function returns the current time as a time_t. On Windows and
Unix-like systems, this is UTC seconds since midnight of January 1,

Does AmigaOS not already have such a function? There's no implementation
in tzcode because it's expected to already exist as part of a lower
level of the C runtime library (and historically it was a direct system
call to the Unix kernel)

> I use tzsetwall() to guess the timezone from the systems locale zone 
> information (GMT+1, etc) and tzset() to load timezone from the TZ 
> environment variable. Should "time_t time(time_t *p)" try to compensate 
> if lclptr is set, or should it always just return the plain system time?

What is the native format of the system time? What are you doing to
determine what the actual time is?

More information about the tz mailing list