Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-06-12
9
Medium Priority
?
385 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 40 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

963 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