Using PC time

possien

New member
Joined
Oct 23, 2008
Messages
2
Programming Experience
1-3
I am building a program to gather information from a serial device. we will use an external GPS device keep the PC's time, then use the system time at precise intervals to send commands to the serial device. The timer control is not ok because we need to fire the commands at precise intervals like every 10 minutes based ont the hour of system time (ie: 12:10, 12:20, 12:30, etc). We are doing this in multiple locations to compare data at specific times. I've got the serial communications down, just not sure how to use the PC's time.

Thanks!
 
1. Dont rely on the GPS time to be right. Write error checking into your code to allow for system outages (I believe it does happen)

2. Run your timer every second to poll for the GPS time, and if it matches your required logic, start a background task to send the GPS time out to whatever needs it.
 
You may actually need to consider using the GPS devices time. If you are running this @ multiple locations, the "current time" on the PC's @ each location will likely rarely match exactly. I know my two machines I'm sitting @ right now differ by a minute most of the time.

You could try executing based on some network polled time, but you run into latency and network outage issues.

Provided the GPS devices are all the same type and derive their data from the same sat sources they -may- be the best source for a "current time" variable.

Of course, all these comments are made knowing very little about your infrastructure, just things you need to think about.

Edit: I see InertiaM provided a simliar thought while I was typing mine sorry for the double!
 
Yeah, the problem is the PC's are in a location that cannot use a network time so by using the GPS, hopefully they will all have the same system time.
 
Back
Top