2009/11/17  <webmas...@opensc-project.org>:
> Revision: 3856
> Author:   viktor.tarasov
> Date:     2009-11-17 11:11:05 +0000 (Tue, 17 Nov 2009)
>
> Log Message:
> -----------
> logs: time stamp; dump_hex() with the static output buffer
> - time stamp in the log messages: for Windows 1msec resolution, otherwise 
> 1sec;
> - one more dump hex function, to be easily inserted into the formatted 
> message.

It is possible to have a higher resolution on Unix using
gettimeofday(3). The resolution is then in µs.

Something like:

struct timeval tv;
struct tm* ptm;
char time_string[40];

 /* Obtain the time of day, and convert it to a tm struct. */
 gettimeofday (&tv, NULL);
 ptm = localtime (&tv.tv_sec);

 /* Format the date and time, down to a single second. */
 strftime (time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);

 /* Print the formatted time, in seconds, followed by a decimal point
   and the milliseconds. */
 sprintf(buf ,"%s.%03ld", time_string, tv.tv_usec / 1000);

-- 
 Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to