The time function in time.h gives milliseconds since the epoch.
+3
A:
You use gettimeofday(2) which is defined in POSIX.1 and BSD.
It returns seconds and microseconds as defined in struct timeval from sys/time.h.
caskey
2009-07-02 04:26:27
+4
A:
This is a simple way:
time_t seconds_since_midnight = time(NULL) % 86400;
To get approximate milliseconds since midnight, multiply seconds_since_midnight
by 1000.
If you need more resolution (consider whether you really do), you will have to use another function such as gettimeofday()
.
Greg Hewgill
2009-07-02 04:34:03
A:
Take a look at gmtime() Converts directly to Coordinated Universal Time (UTC)...
Vaibhav
2009-07-02 04:56:23