473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

System time in miliseconds



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

Mar 3 '06 #1
3 6826
Alex:
System.currentTimeMillis();


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

Mar 3 '06 #2
Alex wrote:


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?


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().

Mar 3 '06 #3
Alex wrote:


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 ();


Try Boost.Datetime, it is not platform-binded. However, standard C++ (as
far as I saw 2005th draft) contains no utilities for such things.
Mar 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: AttiDude | last post by:
Hi, I need some help with some code. I need to know how long the computer is online or how long the user has been logged in. Ok I have a few options: -Take a file that has been created at...
12
by: José | last post by:
I'm programming a simple script to calculate response time from one server to another server. I put the time in secons in a variable. I take the web, and I take the time again, the difference is...
3
by: User | last post by:
Hi, What is the best way to release all resources holded by the Timer (myTimer from class System.Timers.Timer)? Is it: 1- myTimer.dispose 2- myTimer.enabled = false 3- myTimer.close
2
by: Szymon Bobek | last post by:
Hello, Is it possible to get time with precission to 1/100 of second using time.h? If yes - how? If not - where should I search for function which can do it? Thanx, Szymon
6
by: Lorn | last post by:
I was hoping some of you might be able to help me understand the following code defining a typedef for a time query to the WINAPI. I understand the basics of what's going on, I just don't...
1
by: MR | last post by:
Hi, it has been observed that when we try to instantiate a .Net dll for the first time in a session (e.g. from an exe in .Net), it takes almost 10 times compared to subsequent instantiations. ...
2
by: rdraider | last post by:
Hi, We have a lame app that uses 2 datetime(8) fields, 1 stores the date, the other the time. example query: select aud_dt, aud_tm from orders results: aud_dt ...
2
by: jessica6_2000 | last post by:
I have a page where I need to display the unix time (seconds) upon page load. I've found many complex examples that auto update, count live, etc., but I need to just display the time at the time...
5
by: Brian | last post by:
Hello all. I have a simple application that I was using to test and understand the System.Timers.Timer and noticed that when I stop the application, on occasion, it throughs the following...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.