[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

marking time in vb

Posted on 2000-04-18
8
Medium Priority
?
181 Views
Last Modified: 2010-05-02
i want to mark time to as much precision
as possible.  how do i do it in vb?

thanks.
senardji
0
Comment
Question by:senardji
[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
8 Comments
 

Accepted Solution

by:
gafftech earned 200 total points
ID: 2727796
you can use Getsystemtime
Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

Public Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type
Private Sub Command1_Click()
Dim x As SYSTEMTIME
Dim stime As String
GetSystemTime x
Me.Text1.Text = x.wHour & ":" & x.wMinute & ":" & x.wSecond & ":" & x.wMilliseconds
End Sub
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2727844
You asked this same Q twice.

You can't measure time more precisely than the 18.2hz (55ms) timer tick without special hardware.

M
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2727846
You asked this same Q twice.

You can't measure time more precisely than the 18.2hz (55ms) timer tick without special hardware.

M
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 32

Expert Comment

by:Brendt Hess
ID: 2728529
The 18.2hz limit is not a problem anymore.  The system has more accurate timing than that available.

Here's a link to some examples of 1ms precision timers:

http://www.thescarms.com/vbasic/Timer.htm
0
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2728592
The 18.2hz limit is not a problem anymore.  The system has more accurate timing than that available.

Here's a link to some examples of 1ms precision timers:

http://www.thescarms.com/vbasic/Timer.htm
0
 
LVL 6

Expert Comment

by:st_steve
ID: 2729074
use TickCount API....it's an easy way to get the time information..and more accurate than timer control...but not too difficult to declare
0
 

Author Comment

by:senardji
ID: 2738431
thanks all!
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2738457
bhess1,

You should have read the 'fine print'... from the page you cite:

Code based timers are still subject to the operating system's load and preemptive multitasking nature.  For best results, close all unnecessary applications.

Guess what? You simply cannot *guarentee* tight timing with software based timers. You *have* to use hardware as a timing reference if you need *ACCURATE, CONSISTENT, RELIABLE* timing! And the PC simply doesn't have that. If you need a steady "heartbeat" timer that doesn't vary, doesn't jitter, doesn't slop, the only thing you can use on a standard PC is the 18.2Hz time of day clock. If you need tighter times than that you'll have to add hardware.

M
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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

656 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