Thread: fractions of a second w/asctime ?

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    4

    fractions of a second w/asctime ?

    Hello all,
    I need to do some maintenance on a HUGE existing program. The debug output log uses asctime to the output log, but it only goes as small as seconds, nothing less. I need some sub-second metrics.

    This compiles and runs under Unix as a server side app, so I don't want to add any external lib or header references if possible. ie No ATL.

    I've done a lot of msdn searches but cannot find anything. Please help so I don't have to go live in my van down by the river.

    TIA!

  2. #2
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    what UNIX OS are you using?
    I've never don't programming under a UNIX OS, however, I know how to do it under Linux, you need to use a function called gettimeofday:
    Code:
    #include <sys/time.h>
    struct timeval tval;
    gettimeofday(&tval, (struct timezone*)0);
    google for gettimeofday

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    4
    Just had to keep looking. pretty basic. I'm not a big fan of maintaining 100K lines of old code (and that's just this one module!). Hey, it's a job. Just append the millisecond value to the string and I'm done.

    Code:
    	
    	#include "afx.h"
    	SYSTEMTIME systime;
    	GetSystemTime(&systime);
    	int imills = systime.wMilliseconds;
    	printf("millisecond stamp: %i\n", imills);
    Time for lunch.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fractions
    By zdream8 in forum C Programming
    Replies: 2
    Last Post: 05-21-2008, 09:54 PM
  2. Algebraic Fractions
    By treenef in forum C++ Programming
    Replies: 8
    Last Post: 12-20-2005, 05:10 AM
  3. Greatest Common Factors of Fractions
    By sonict in forum C++ Programming
    Replies: 1
    Last Post: 01-15-2003, 04:33 AM
  4. Fractions
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2002, 07:51 AM
  5. Decimals to Fractions
    By ToasterPas in forum C++ Programming
    Replies: 4
    Last Post: 12-28-2001, 12:58 PM