By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Record milliseconds

P: n/a
Hi all,
is there a function that will record milliseconds? Something along the
line of Now() perhaps?

This will be recorded into a text file rather than a table.

TIA,

Mark
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
mark, this is a common request but not a commonly known solution. There
are 2 ways to attack this problem.

1) u can use the system clock and a function GetTickCount Lib
"kernel32"() to get the time elapsed since midnight. This time is
returned in milliseconds. and then u work from there. i really can't
comment more on this method without data def.
2) u can convert ur time to milliseconds by hard coding it. That is,
convert all ur hours to milliseconds, then minutes, then seconds and
then sum them all. this method is bulky though and the first is the
preferred road to take.

u can some more info here.
http://www.developerfusion.com/forums/topic-26515
and here http://www.tek-tips.com/faqs.cfm?fid=2292

good luck.

Nov 13 '05 #2

P: n/a
Angelo wrote:
mark, this is a common request but not a commonly known solution. There
are 2 ways to attack this problem.

1) u can use the system clock and a function GetTickCount Lib
"kernel32"() to get the time elapsed since midnight. This time is
returned in milliseconds. and then u work from there. i really can't
comment more on this method without data def.


IIRC, the system clock, although returning something that looks like it
is accurate to a millisecond, is quite a bit less accurate in practice.
The numbers aren't too far off but they can vary considerably within
the second depending on what the OS is doing at the moment. I'm not
talking about a slowing clock setting due to a dying battery on the
motherboard. I wouldn't count on the system clock being closer than
about .05 second to the actual fraction of a second. In short, the
clock ticks themselves are not perfectly regular so don't assume you're
getting perfect accuracy in spite of those extra decimals you see. I
realize this seems strange considering the extraordinary regularity of
solid-state timers but I read about the system clock variations
somewhere when I was doing some data acquisition. I don't have the
reference anymore. YMMV.

James A. Fortune

Nov 13 '05 #3

P: n/a
On 23 Jun 2005 11:00:12 -0700, ji********@compumarc.com wrote:
Angelo wrote:
mark, this is a common request but not a commonly known solution. There
are 2 ways to attack this problem.

1) u can use the system clock and a function GetTickCount Lib
"kernel32"() to get the time elapsed since midnight. This time is
returned in milliseconds. and then u work from there. i really can't
comment more on this method without data def.
IIRC, the system clock, although returning something that looks like it
is accurate to a millisecond, is quite a bit less accurate in practice.
The numbers aren't too far off but they can vary considerably within
the second depending on what the OS is doing at the moment. I'm not

And that's the problem. The clock itself is reasonably accurate. However,
there is always some delay between when you ask for the time and when the
computer gets around to actually giving it to you. The problem is that the
deley is an unmeasurable variable. "depending on what the OS is doing at the
moment." Chuck.
talking about a slowing clock setting due to a dying battery on the
motherboard. I wouldn't count on the system clock being closer than
about .05 second to the actual fraction of a second. In short, the
clock ticks themselves are not perfectly regular so don't assume you're
getting perfect accuracy in spite of those extra decimals you see. I
realize this seems strange considering the extraordinary regularity of
solid-state timers but I read about the system clock variations
somewhere when I was doing some data acquisition. I don't have the
reference anymore. YMMV.

James A. Fortune


Nov 13 '05 #4

P: n/a
James,
What a great tip! I use the tick count in my Progress Bar
routine to tell the user how much time left, 10, 9, 8, seconds, et
cetera which I superimpose on the Bar. I do this by measuring the
time since the last Progress Bar update. I had always noticed how much
it jumped around, even though I average the last 50 elapsed times.
This probably explains that phenomena.
Hank Reed

Nov 13 '05 #5

P: n/a
On 24 Jun 2005 06:49:07 -0700, "Hank" <ha********@aol.com> wrote:
James,
What a great tip! I use the tick count in my Progress Bar
routine to tell the user how much time left, 10, 9, 8, seconds, et
cetera which I superimpose on the Bar. I do this by measuring the
time since the last Progress Bar update. I had always noticed how much
it jumped around, even though I average the last 50 elapsed times.
This probably explains that phenomena.
Hank Reed

I'm not so sure. Whole seconds should not be a problem. Miliseconds and even
hundredths are problems.

Chuck
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.