Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Function that returns milliseconds..

8 views
Skip to first unread message

Thomas Regin

unread,
Apr 9, 2002, 10:59:22 AM4/9/02
to
Hey there!

I need a function that makes it possible, like in C++ and
Java, to return the number of milliseconds since January 1
1970. Does this function exist in VB and if so, how do I
use it?

Thanks in advance,

Thomas Regin.

Jeff Johnson

unread,
Apr 9, 2002, 12:04:08 PM4/9/02
to

"Thomas Regin" <t...@thomas-regin.com> wrote in message
news:058001c1dfd7$21ea7220$19ef2ecf@tkmsftngxa01...

> I need a function that makes it possible, like in C++ and
> Java, to return the number of milliseconds since January 1
> 1970. Does this function exist in VB and if so, how do I
> use it?

The most granular you can get with VB is seconds, so you could multiply that
by 1000, but you won't be in control of the last 3 digits.


Steve James

unread,
Apr 9, 2002, 12:32:08 PM4/9/02
to
You can use the following;

Print (CDbl(Now - CDate("01/01/1970")) * 24 * 60 * 60 * 1000)

but this is only accurate to 1 second. It always returns a number that wnds
in 3 zeros. You could use something like this in combination with an API
call such as timeGetTime:

Private Declare Function timeGetTime Lib "winmm.dll" () As Long

which returns the current sustem time in milliseconds.

Hope this helps.

Steve


"Thomas Regin" <t...@thomas-regin.com> wrote in message
news:058001c1dfd7$21ea7220$19ef2ecf@tkmsftngxa01...

Thomas Regin

unread,
Apr 9, 2002, 1:56:10 PM4/9/02
to

Thank you very much to both of you!! I got my problem
solved!

Thomas Regin

>.
>

Joe "Nuke Me Xemu" Foster

unread,
Apr 9, 2002, 2:38:36 PM4/9/02
to
"Thomas Regin" <t...@thomas-regin.com> wrote in message <news:058001c1dfd7$21ea7220$19ef2ecf@tkmsftngxa01>...

> I need a function that makes it possible, like in C++ and


> Java, to return the number of milliseconds since January 1
> 1970. Does this function exist in VB and if so, how do I
> use it?

And I suppose you're going to want the answer RightNow, huh?

URL:http://groups.google.com/groups?selm=%23kmFSP1tBHA.2676%40tkmsftngp04

URL:http://groups.google.com/groups?selm=eIFcts0qBHA.2080%40tkmsftngp03

msec = (rightnow - #01/01/1970 00:00:00#) * 1000 / (#00:00:01# - #00:00:00#)

--
Joe Foster <mailto:jlfoster%40znet.com> Sacrament R2-45 <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!


Bob O`Bob

unread,
Apr 9, 2002, 7:21:29 PM4/9/02
to
Thomas Regin wrote:
>
> Thank you very much to both of you!! I got my problem
> solved!


I hope you understand that precision and accuracy
are significantly different commodities...


Bob
--
posting from work, but representing only myself

Joe "Nuke Me Xemu" Foster

unread,
Apr 10, 2002, 12:34:12 AM4/10/02
to
"Bob O`Bob" <b...@cluestick.org> wrote in message <news:3CB377...@cluestick.org>...

> Thomas Regin wrote:
> >
> > Thank you very much to both of you!! I got my problem
> > solved!

> I hope you understand that precision and accuracy
> are significantly different commodities...

...but *this* one goes to ELEVEN!!!1!

--
Joe Foster <mailto:jlfoster%40znet.com> Wanna buy a Bridge? <http://xenu.net/>

Bob O`Bob

unread,
Apr 10, 2002, 8:09:31 PM4/10/02
to
Joe "Nuke Me Xemu" Foster wrote:
>
> "Bob O`Bob" <b...@cluestick.org> wrote in message <news:3CB377...@cluestick.org>...
>
> > Thomas Regin wrote:
> > >
> > > Thank you very much to both of you!! I got my problem
> > > solved!
>
> > I hope you understand that precision and accuracy
> > are significantly different commodities...
>
> ...but *this* one goes to ELEVEN!!!1!


Yeah, and I literally *wasted* two months of my life trying to
write a stopwatch app with mere 0.003 second accuracy.

Simply can not be done with Windows, period.


(well, I suppose maybe it could in CE - the only thing
from MS ever to have even half-decent RTOS features.)

Joe "Nuke Me Xemu" Foster

unread,
Apr 12, 2002, 10:34:17 AM4/12/02
to
"Bob O`Bob" <b...@cluestick.org> wrote in message <news:3CB4D4...@cluestick.org>...

> Joe "Nuke Me Xemu" Foster wrote:
> >
> > "Bob O`Bob" <b...@cluestick.org> wrote in message <news:3CB377...@cluestick.org>...

> > > I hope you understand that precision and accuracy


> > > are significantly different commodities...
> >
> > ...but *this* one goes to ELEVEN!!!1!
>
>
> Yeah, and I literally *wasted* two months of my life trying to
> write a stopwatch app with mere 0.003 second accuracy.
>
> Simply can not be done with Windows, period.

> (well, I suppose maybe it could in CE - the only thing
> from MS ever to have even half-decent RTOS features.)

What! Windows NT/XP Embedded isn't where you want to go today?
Say it ain't so! Why, 640 XP ought to be enough for anybody...

--
Joe Foster <mailto:jlfoster%40znet.com> Space Cooties! <http://www.xenu.net/>

0 new messages