[tz] Adapting localtime.c

Christos Zoulas christos at zoulas.com
Sat Oct 8 20:12:56 UTC 2016


On Oct 8,  7:27pm, cs at innolan.dk (Carsten Larsen) wrote:
-- Subject: [tz] Adapting localtime.c

| 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.
| 
| 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?
| 
| I hope someone knows the answer and also thank you for any 
| clarifications on this issue.

man 3 time does :-)

The time() function returns the value of time in seconds since 0 hours, 0
minutes, 0 seconds, January 1, 1970, Coordinated Universal Time.

christos



More information about the tz mailing list