Connecting Tech Pros Worldwide Forums | Help | Site Map

System time in miliseconds

Alex
Guest
 
Posts: n/a
#1: Mar 3 '06


Hello,

I'm starting to spam this group..I need a function that is equal to
this function in JAVA:

System.currentTimeMillis();

that returns the difference, measured in milliseconds, between the
current time and midnight, January 1, 1970 UTC. (output is like this:
1141375007171 )
I used the function:

timeGetTime ();

but the output is 4476095..What shall I do?

Thx a lot,

Sashka


marcwentink@hotmail.com
Guest
 
Posts: n/a
#2: Mar 3 '06

re: System time in miliseconds


Alex:
[color=blue]
> System.currentTimeMillis();[/color]

I do not think there is a standard cpp-function for this, normally time
statements use ctime like in:

http://www.cplusplus.com/ref/ctime/ctime.html

Marc Wentink

Rolf Magnus
Guest
 
Posts: n/a
#3: Mar 3 '06

re: System time in miliseconds


Alex wrote:
[color=blue]
>
>
> Hello,
>
> I'm starting to spam this group..I need a function that is equal to
> this function in JAVA:
>
> System.currentTimeMillis();
>
> that returns the difference, measured in milliseconds, between the
> current time and midnight, January 1, 1970 UTC. (output is like this:
> 1141375007171 )
> I used the function:
>
> timeGetTime ();
>
> but the output is 4476095..What shall I do?[/color]

There is no standard C++ function that gives you what you want, so you have
to resort to system-specific functions. On POSIX systems, you can try the
function gettimeofday().

Aleksander Beluga
Guest
 
Posts: n/a
#4: Mar 3 '06

re: System time in miliseconds


Alex wrote:[color=blue]
>
>
> that returns the difference, measured in milliseconds, between the
> current time and midnight, January 1, 1970 UTC. (output is like this:
> 1141375007171 )
> I used the function:
>
> timeGetTime ();
>[/color]

Try Boost.Datetime, it is not platform-binded. However, standard C++ (as
far as I saw 2005th draft) contains no utilities for such things.
Closed Thread