Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!slxsys!ibmpcug!mantis!mathew From: mathew@mantis.co.uk (mathew) Newsgroups: comp.os.msdos.programmer Subject: Re: Time Zones: A Plea for Standards? Message-ID: Date: 16 Apr 91 14:56:22 GMT References: <1991Apr15.200244.7775@cc.curtin.edu.au> Organization: Mantis Consultants, Cambridge. UK. Lines: 39 nmurrayr@cc.curtin.edu.au (Ron Murray) writes: > While it's nice to see that programmers are beginning to realise that ther > IS life outside their own country / timezone, it would be nice if they could > find some way of specifying this timezone without using a TZ environment > variable. The TZ environment variable is part of MS-DOS. Programs should not use it directly, but should use the supplied MS-DOS calls, as in the following MSC program: #include #include int daylight; long timezone; char *tzname[]; main() { time_t tnow; time(&tnow); printf(" Local time is %s\n",asctime(localtime(&tnow))); printf("Universal time is %s\n",asctime(gmtime(&tnow))); tzset(); printf("Daylight savings time flag = %d\n", daylight); printf("Time offset = %ld\n", timezone); printf("Time zone = %s\n", tzname[0]); } Any program which looks at TZ directly is evil and rude, and should not be tolerated. mathew [ GMT0BST ] -- If you're a John Foxx fan, please mail me!