From: Brian DOT Smith AT PicoDyne DOT com (Brian Smith) Subject: RE: Problem with Grabbing System Time 20 Dec 1998 20:53:27 -0800 Message-ID: <002e01be2c86$8feff4a0$44032599.cygnus.gnu-win32@fred> References: <367D2692 DOT 2374B022 AT erols DOT com> Reply-To: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_002F_01BE2C5C.A71B7340" To: "Gnu-Win32 AT Cygnus. Com" This is a multi-part message in MIME format. ------=_NextPart_000_002F_01BE2C5C.A71B7340 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Not sure I can tell you anything specific, but that date seems awfully close to the UNIX epoch, or time zero. Perhaps you aren't adding an offset to get todays date. Brian - Brian S. Smith - PicoDyne Corporation - Annapolis Engineering Office -(v)410-266-8828 (fax)410-266-8872 -----Original Message----- From: owner-gnu-win32 AT cygnus DOT com [mailto:owner-gnu-win32 AT cygnus DOT com]On Behalf Of Dominia Sent: Sunday, December 20, 1998 11:32 AM To: gnu-win32 AT cygnus DOT com Subject: Problem with Grabbing System Time Greetings, I was having some trouble with porting a Unix application to Windows in that the gettimeofday doesn't seem to be working correctly. The larger program I am working with is returning: Wed Feb 11 21:21:36 1970 as the current system time, but my system clock was set to: Sun Dec 20 11:13:23 1998 when the "time" command was run. I tried running the following snippet to check what actual time my system was returning. It consistently returns dates from February of 1970. 3 1 11 21:33:39 70 ( this is equivalent to Wed Feb 11 21:33:39 1970 ) At least it's incrementing the clock, but I can't figure out why it's not current. Is there something I am missing? Whatever it is, I am just not seeing it. Is it my system? Is it me? What?? Any help would be appreciated. Thanks, Paula (The following was compiled via gcc on the command line with just "gcc test.c" and then I ran ./a.out and got the results I reported above.) #include #include main() struct timeval tp; struct timezone tzp; struct tm *lt; long secs1970; gettimeofday(&tp, &tzp); secs1970= tp.tv_sec; lt = localtime(&secs1970); printf("%d %d %d %d:%d:%d %d\n", lt->tm_wday, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, lt->tm_year ); } ------=_NextPart_000_002F_01BE2C5C.A71B7340 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Not=20 sure I can tell you anything specific, but that date seems awfully close = to the=20 UNIX epoch, or time zero.  Perhaps you aren't adding an offset to = get=20 todays date.
 
Brian
 

-        Brian S.=20 Smith
-     PicoDyne Corporation
-  = Annapolis=20 Engineering Office
-(v)410-266-8828 (fax)410-266-8872 =

-----Original Message-----
From: = owner-gnu-win32 AT cygnus DOT com=20 [mailto:owner-gnu-win32 AT cygnus DOT com]On Behalf Of=20 Dominia
Sent: Sunday, December 20, 1998 11:32 = AM
To: gnu-win32 AT cygnus DOT com
Subje= ct:=20 Problem with Grabbing System=20 Time

Greetings,=20

I was having some trouble with porting a Unix application = to=20 Windows in that the gettimeofday doesn't seem to be working = correctly. The=20 larger program I am working with is returning:=20

Wed Feb 11 21:21:36 1970=20

as the current system time, but my system clock was set=20 to:=20

Sun Dec 20 11:13:23 1998=20

when the "time" command was run.=20

I tried running the following snippet to check what actual = time my=20 system was returning. It consistently returns dates from February of = 1970.=20

3 1 11 21:33:39 70 ( this is equivalent to Wed Feb 11 = 21:33:39=20 1970 )=20

At least it's incrementing the clock, but I can't figure = out why=20 it's not current. Is there something I am missing? Whatever it is, I = am just=20 not seeing it. Is it my system? Is it me? What?? Any help would be=20 appreciated.
 =20

Thanks,=20

Paula=20

(The following was compiled via gcc on the command line = with just=20 "gcc test.c" and then I ran ./a.out and got the results I = reported=20 above.)
 =20

     #include = <sys/types.h>=20
     #include = <sys/time.h>=20
     main() {=20
         struct = timeval=20 tp; struct timezone tzp;=20
         struct = tm=20 *lt; =
        =20 long secs1970;=20

        =20 gettimeofday(&tp, &tzp);=20
         = secs1970=3D=20 tp.tv_sec;=20
         lt =3D=20 localtime(&secs1970);=20
         = printf("%d=20 %d %d %d:%d:%d %d\n",=20
         = lt->tm_wday,=20 lt->tm_mon,  lt->tm_mday,=20
         = lt->tm_hour,=20 lt->tm_min,  lt->tm_sec, lt->tm_year=20
         = );=20
     } =

------=_NextPart_000_002F_01BE2C5C.A71B7340-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".