cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2958074 ] --trace-time prints system-uptime instead of actual time WIN

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 26 Feb 2010 13:13:50 +0000

Bugs item #2958074, was opened at 2010-02-24 16:37
Message generated for change (Comment added) made by yangtse
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2958074&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: debug/info output
Group: wrong behaviour
>Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: spsp (spsp)
Assigned to: Daniel Stenberg (bagder)
Summary: --trace-time prints system-uptime instead of actual time WIN

Initial Comment:
Windows XP SP3 (32bit)
curl 7.19.7 (i386-pc-win32) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3 libidn/1.14 libssh2/1.2.1
Protocols: tftp ftp telnet dict ldap http file https ftps scp sftp
Features: IDN Largefile NTLM SSL SSPI libz
(also tried with 7.20.0 and 7.19.5, same result)

curl --trace-time -v -O <some URL or ftp>

In the Output, the time reported doesn't make sense (always low hours 0 / 1 / 2 are reported), neither hours, nor minutes.
Changing System Time has no effect on the curl output. time /T in cmd window reports correct time.
Windows Restart didn't help, BUT! changed the reported time, kinda resetted it to 00 hours.

After looking into the code, I think the time displayed from --trace-time is the Windows uptime instead of the actual time.
main.c [function] my_trace(...)
  tv = cutil_tvnow(); // returns uptime, see below
  secs = tv.tv_sec;
  now = localtime(&secs); /* not multithread safe but we don't care */ // translates uptime to hours, minutes, ... ?
  if(config->tracetime)
    snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
             now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);

crlutil.c
struct timeval cutil_tvnow(void)
{
  /*
  ** GetTickCount() is available on _all_ Windows versions from W95 up
  ** to nowadays. Returns milliseconds elapsed since last system boot, // <<-- here we have it
  ** increases monotonically and wraps once 49.7 days have elapsed.
  */
  struct timeval now;
  DWORD milliseconds = GetTickCount();
  now.tv_sec = milliseconds / 1000;
  now.tv_usec = (milliseconds % 1000) * 1000;
  return now;
}

----------------------------------------------------------------------

Comment By: Yang Tse (yangtse)
Date: 2010-02-26 13:13

Message:
Thanks for the report, this problem is now fixed in CVS!

----------------------------------------------------------------------

Comment By: spsp (spsp)
Date: 2010-02-26 13:04

Message:
Thanks for the new daily snapshot.
Tested and worked for me. Shows the actual time now.
I'm not sure if I should change the status to closed, so I left it open.

PS: A workaround for older curl versions would be to boot the computer at
00:00 ; )

----------------------------------------------------------------------

Comment By: spsp (spsp)
Date: 2010-02-26 13:04

Message:
Thanks for the report, this problem is now fixed in CVS!

----------------------------------------------------------------------

Comment By: Yang Tse (yangtse)
Date: 2010-02-26 12:54

Message:
The cURL project only provides source packages. So, if you can build from
source then you can try daily snapshot http://curl.haxx.se/snapshots/ with
date February 26, 2010.

----------------------------------------------------------------------

Comment By: spsp (spsp)
Date: 2010-02-25 10:15

Message:
I can't get through the firewall here.
If you could put the source or a compiled windows exe somwhere for
download, I'll try it out.

----------------------------------------------------------------------

Comment By: Yang Tse (yangtse)
Date: 2010-02-25 07:12

Message:
Yes the problem you describe could easily be repeated on Windows, which
would report time since last boot instead of local time.

On systems using the Monotonic time source for which the origin of time
would not be the epoch, but simply an arbitrary point in time, this would
equally represent a problem.

I've fixed this now in CVS, along with the time stamps generated from the
C test harness servers which had the same problem.

Could you try CVS version to verify if the fix is good for you?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2958074&group_id=976
Received on 2010-02-26

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET