PDA

View Full Version : DateTime formats and double/float formats


nevarmore
08-05-2004, 06:28 PM
What I'm working with involves gathering speed and distance information from a GPS device. To the layman, I'm using it to augment/check my cars speedometer and odometer.

At present my device outputs lat/long coordinates and ground speed. At present I'm only concerned about collecting the speed data and then calculating distance from that based on time.

What I need to do is multiply my speed (distance / time) by time to get distance. I am currently playing around with the DateTime class. I am used to time formats that I could do DateTime.Now - myStartTime = myElapsedTime where my Elapsed time is in milliseconds. However DateTime doesn't seem to work like this.

Do the DateTime.getHours, .getMilliseconds, getSeconds, etc functions return the total time in whatever units or do they only return the individual hours/minutes/seconds/milliseconds fields?

nevarmore
08-05-2004, 06:41 PM
Thank you CoderForums for magically answering my questions.

Seems like every time I post, not 5 minutes later I see the answer online or in the API docs.

Anyhow, TimeSpan (the result of DateTime.now - myDateTime) has a function .TotalHours which is going to make the math damn near trivial with no further unit conversions.

Whiteknight
08-06-2004, 09:27 AM
...uh, glad we could help...