Mail Archives: cygwin/1999/01/13/04:57:06
I'm real confused about this, and would appreciate any help that could
be offered...
The following code (snipped and pieced together from a much larger
program), when compiled with CYGWIN B18, and later on a Linux box,
produces the expected results. However, when compiled with B20, it
says:
> The current time is Fri Jan 16 02:31:17 1970
> #include <sys/types.h>
> #include <sys/time.h>
> #include <ctype.h>
> #include <errno.h>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <stdarg.h>
> #include <time.h>
>
>
> int main( int argc, char **argv )
> {
> time_t current_time;
> char *time;
> struct timeval now_time;
> /*
> * Init time.
> */
> gettimeofday( &now_time, NULL );
> current_time = (time_t) now_time.tv_sec;
> time = ctime(¤t_time);
> time[strlen(time)-1] = '\0';
>
> fprintf(stderr, "The current time is %s\n\r", time);
> return 0;
> }
>
Any idea why?
Forgive me if the answer is something really obvious... I'm still in the
process of learning C. This would be the reason I got the CYGWIN
compiler in the first place.
-
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".
- Raw text -