Solved

How to get the time lapsed from 1970 Jan midnight in milliseconds?

Posted on 2001-06-12
9
375 Views
Last Modified: 2010-05-02
Hi all,
   
     I want to calculate the response time for a particular request.WebBrowser component is used in my appln.It has two methods(DownloadBegin,DownLoadComplete and DocumentComplete).I need to get the time in milliseconds when the downloadBegin and DownloadComplete called.

    How to get the time in milliseconds in VB 6.0? Is there any methods like CurrentTimeMillis in JAVA(It will return a long which contains the time lapsed in milliseconds from 1970 Jan midnight to current time).
               Thanks in advance.
Prabath.
0
Comment
Question by:prabath
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 15

Expert Comment

by:robbert
ID: 6184591
sngStartTime = Timer

' do stuff

Response.Write Timer - sngStartTime ' 1.23235355 seconds
0
 
LVL 15

Accepted Solution

by:
robbert earned 10 total points
ID: 6184595
Oh, that was ASP. VB:

Dim sngStartTime As Single
sngStartTime = Timer
' do stuff
Debug.Print Timer - sngStartTime ' 1.23235355 seconds
0
 
LVL 15

Expert Comment

by:robbert
ID: 6184633
Additionally,

lngMilliSecondsElapsed = DateDiff("s", Now, "1/1/1970") * 1000
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 6

Expert Comment

by:andyclap
ID: 6190132
The resolution of the standard time/timer/date objects is not millisecond accurate (about 19ms is it's finest resolution).

You could look at using multimedia timers which can have millisecond precision, if you really need this.

Have a look at
http://pages.about.com/vbmakai/st1.htm
for a sample project which uses these timers.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136003
Hi prabath,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept robbert's comment(s) as an answer.

prabath, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7169184
Comment from expert accepted as answer

Computer101
E-E Moderator
0
 
LVL 1

Expert Comment

by:alldata
ID: 24044936
In Robbert's code snippet the date values where backwards so it was returning a negative value.

Wrong:
lngMilliSecondsElapsed = DateDiff("s", Now, "1/1/1970") * 1000

Right:
lngMilliSecondsElapsed = DateDiff("s", "1/1/1970", Now) * 1000

No biggie, just thought I would save someone the hassle of figuring this out.
0
 
LVL 6

Expert Comment

by:andyclap
ID: 24053222
seven years!
0
 
LVL 1

Expert Comment

by:alldata
ID: 24062901
Whoa...sorry! I didn't look at the timestamp...
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question