Hi Patrick,

2010/4/20 Patrick Galbraith <[email protected]>:
> Hi all,
>
> I've stumbled across an issue with gettimeofday() returning an incorrect
> value with mingw-w64. A simple code sample:
>
> #include <stdio.h>
> #include <sys/time.h>
>
> int main (void)
> {
>  struct timeval timer;
>  int retval;
>  retval= gettimeofday(&timer,NULL);
>  fprintf(stderr, "retval: %d\n", retval);
>  fprintf(stderr, "now: %ld\n", time(0));
>  fprintf(stderr, "now: %ld\n", timer.tv_sec);
>  return(0);
>
> }
>
> When compiled using -
>
> regular mingw (correct output)
>
> Patrick galbra...@win-7a3e68a2d98 ~/dev/stuff
> $ gcc -o mtime mtime.c
>
> Patrick galbra...@win-7a3e68a2d98 ~/dev/stuff
> $ ./mtime.exe
> retval: 0
> now: 1271722468
> now: 1271722468
>
> mingw-w64:
>
>
> Patrick galbra...@win-7a3e68a2d98 ~/dev/stuff
> $ /c/mingw/bin/x86_64-w64-mingw32-gcc -o mtime mtime.c
>
> Patrick galbra...@win-7a3e68a2d98 ~/dev/stuff
> $ ./mtime.exe
> retval: 0
> now: 1271722480
> now: 31293027
>
> Are there any known issues with gettimeofday() with mingw-w64?
>
> Thanks!
>
> Patrick
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

what you are seeing here is that time_t type has changed for x64. x64
doesn't use any longer a 32-bit time_t type. I use 64-bit wide scalar
instead.
If you want to have 32-bit time_t the use please the <timefunction>32
function set and use instead tim32_t type.

Regards,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to