cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
how can convert current date to miliseco
how can convert current date to miliseconds from 1970(epoch actually)?
Feb 2, 2011 at 1:49pm UTC
subrat7551
(4)
how can convert current date to miliseconds from 1970(epoch actually)?
Feb 2, 2011 at 2:02pm UTC
Jake94
(16)
Well, first you must find a function that returns the amount of seconds since the epoch. Then you can divide that number by 1000 to get the total amount of milliseconds. I hope this helps!
Feb 2, 2011 at 2:04pm UTC
kbw
(9488)
There isn't a portable way because different systems have different calls to get time with higher resolution than a second.
If you're using POSIX, call gettimeofday then convert the time_t part and tack on on the fractional part.
If you're using Window, call GetLocalTime then convert that.
Last edited on
Feb 2, 2011 at 2:05pm UTC
Topic archived. No new replies allowed.