Solved

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

Posted on 2001-06-12
9
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

710 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