Click here to Skip to main content
15,886,199 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Is DateTime.Now property precise Pin
Kenneth Haugland11-Apr-13 9:35
mvaKenneth Haugland11-Apr-13 9:35 
GeneralRe: Is DateTime.Now property precise Pin
econy11-Apr-13 9:46
econy11-Apr-13 9:46 
GeneralRe: Is DateTime.Now property precise Pin
Kenneth Haugland11-Apr-13 9:52
mvaKenneth Haugland11-Apr-13 9:52 
AnswerRe: Is DateTime.Now property precise Pin
Eddy Vluggen11-Apr-13 9:42
professionalEddy Vluggen11-Apr-13 9:42 
GeneralRe: Is DateTime.Now property precise Pin
econy11-Apr-13 9:50
econy11-Apr-13 9:50 
GeneralRe: Is DateTime.Now property precise Pin
Eddy Vluggen11-Apr-13 9:52
professionalEddy Vluggen11-Apr-13 9:52 
AnswerRe: Is DateTime.Now property precise [solved] Pin
Dave Kreskowiak11-Apr-13 10:27
mveDave Kreskowiak11-Apr-13 10:27 
AnswerRe: Is DateTime.Now property precise [solved] Pin
Alan N11-Apr-13 13:23
Alan N11-Apr-13 13:23 
On most computers the minimum increment of the DateTime.Now property is 15.625ms, so on average your timestamps will be accurate to about half of that. A 200ms timer won't fire at exactly 200ms (probably 190-210) but your observation of a consistently prolonged interval is indicative of a delayed timer event. The most likely reason for this is that the time taken to read the device and process the data is actually 500-700ms.

To find out what's going on, a bit more data needs to be gathered within your timer event handler.

PSEUDOCODE
==========

OnTimerTick()
  ts1 = GetTimeStamp
  ReadDevice
  ts2 = GetTimeStamp
  ProcessData
  ts3 = GetTimeStamp

and then calculate
readingTime =  ts2 - ts1 
processingTime = ts3 - ts2


You can use the System.Diagnostics.Stopwatch class to get microsecond accurate timestamps.

Alan.
QuestionHow to create a new project to run a class [solved] Pin
econy11-Apr-13 8:47
econy11-Apr-13 8:47 
AnswerRe: How to create a new project to run a class Pin
Kenneth Haugland11-Apr-13 9:20
mvaKenneth Haugland11-Apr-13 9:20 
AnswerRe: How to create a new project to run a class Pin
Eddy Vluggen11-Apr-13 9:21
professionalEddy Vluggen11-Apr-13 9:21 
GeneralRe: How to create a new project to run a class Pin
Kenneth Haugland11-Apr-13 9:27
mvaKenneth Haugland11-Apr-13 9:27 
GeneralRe: How to create a new project to run a class Pin
Eddy Vluggen11-Apr-13 9:30
professionalEddy Vluggen11-Apr-13 9:30 
GeneralRe: How to create a new project to run a class Pin
Kenneth Haugland11-Apr-13 9:32
mvaKenneth Haugland11-Apr-13 9:32 
GeneralRe: How to create a new project to run a class Pin
Eddy Vluggen11-Apr-13 9:37
professionalEddy Vluggen11-Apr-13 9:37 
GeneralRe: How to create a new project to run a class Pin
Kenneth Haugland11-Apr-13 9:45
mvaKenneth Haugland11-Apr-13 9:45 
GeneralRe: How to create a new project to run a class Pin
Eddy Vluggen11-Apr-13 9:51
professionalEddy Vluggen11-Apr-13 9:51 
GeneralRe: How to create a new project to run a class Pin
econy11-Apr-13 9:33
econy11-Apr-13 9:33 
QuestionVB.Net timer function [solved] Pin
econy11-Apr-13 7:32
econy11-Apr-13 7:32 
AnswerRe: VB.Net timer function Pin
Eddy Vluggen11-Apr-13 8:07
professionalEddy Vluggen11-Apr-13 8:07 
AnswerRe: VB.Net timer function Pin
Richard Deeming11-Apr-13 8:09
mveRichard Deeming11-Apr-13 8:09 
AnswerRe: VB.Net timer function Pin
Dave Kreskowiak11-Apr-13 8:15
mveDave Kreskowiak11-Apr-13 8:15 
GeneralRe: VB.Net timer function Pin
econy11-Apr-13 8:27
econy11-Apr-13 8:27 
QuestionVB 2010 How to Find, counts and move selected same items on List View ? Pin
Yazid Aura Robbani11-Apr-13 6:33
professionalYazid Aura Robbani11-Apr-13 6:33 
QuestionRe: VB 2010 How to Find, counts and move selected same items on List View ? Pin
Eddy Vluggen11-Apr-13 8:09
professionalEddy Vluggen11-Apr-13 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.