Article View: comp.os.msdos.programmer
Article #5840Re: Time Zones: A Plea for Standards?
From: mathew
Date: Tue, 16 Apr 1991 14:56
Date: Tue, 16 Apr 1991 14:56
39 lines
1531 bytes
1531 bytes
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 <stdio.h>
#include <time.h>
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!
Technical Details
Message-ID:
<No5H110w164w@mantis.co.uk>Path:
arc1-ca.pugleaf.net!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!mathewReferences:
<1991Apr15.200244.7775@cc.curtin.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <No5H110w164w@mantis.co.uk> Date: 16 Apr 91 14:56:22 GMT References: <1991Apr15.200244.7775@cc.curtin.edu.au> Organization: Mantis Consultants, Cambridge. UK. Lines: 39