time-precision

How accurate can I expect the time to be from a stratum 0 NTP server on the same subnet on ethernet?

I have an application that depends on gpsd and ntpd to accurately set the system time on a linux machine. gpsd is fed NMEA + PPS The application is punping ~25MB per second over the network and I think the loading on the system is causing jitter in the time somehow. (loaded PCI express bus causing irregular interrupt latency) I have a...

System.currentTimeMillis vs System.nanoTime

Accuracy Vs. Precision What I would like to know is whether I should use System.currentTimeMillis() or System.nanoTime() when updating my object's positions in my game? Their change in movement is directly proportional to the elapsed time since the last call and I want to be as precise as possible. I've read that there are some seriou...

How to measure time in milliseconds using ANSI C?

Using only ANSI C, is there any way to measure time with milliseconds precision or more? I was browsing time.h but I only found second precision functions. ...

Function that creates a timestamp in c#

Hi there, I was wondering, is there a way to create a timestamp in c# from a datetime? I need a millisecond precision value that also works in Compact Framework(saying that since DateTime.ToBinary() does not exist in CF). My problem is that i want to store this value in a database agnostic way so i can sortby it later and find out whic...

Actionscript 3 high precision time method (microseconds)?

I need a high precision time method in microseconds rather than milliseconds for actionscript, unfortunately I couldn't find much help on the web. I need such control in order to implement the usage of a fixed timestep in transitions as described in this article: http://gafferongames.com/game-physics/fix-your-timestep/, in order to solv...

C# DateTime.Now precision

I just ran into some unexpected behavior with DateTime.UtcNow while doing some unit tests. It appears that when you call DateTime.Now/UtcNow in rapid succession, it seems to give you back the same value for a longer-than-expected interval of time, rather than capturing more precise millisecond increments. I know there is a Stopwatch cl...

Storing microseconds in MySQL: which workaround?

Hi, we're writing a scientific tool with MySQL support. The problem is, we need microsecond precision for our datetime fields, which MySQL doesn't currently support. I see at least two workarounds here: Using a decimal() column type, with integer part corresponding to seconds since some point in time (I doubt that UNIX epoch will do, ...

How can I (reasonably) precisely perform an action every N milliseconds?

I have a machine which uses an NTP client to sync up to internet time so it's system clock should be fairly accurate. I've got an application which I'm developing which logs data in real time, processes it and then passes it on. What I'd like to do now is output that data every N milliseconds aligned with the system clock. So for exampl...

How precise is the internal clock of a modern PC?

I know that 10 years ago, typical clock precision equaled a system-tick, which was in the range of 10-30ms. Over the past years, precision was increased in multiple steps. Nowadays, there are ways to measure time intervals in actual nanoseconds. However, usual frameworks still return time with a precision of only around 15ms. My questio...

C# get time in milliseconds

I'm making a program in which I need to get the time in milliseconds. By time, I mean a number that is never equal to itself, and is always 1000 numbers bigger than it was a second ago. I've tried converting DateTime.Now to a TimeSpan and getting the TotalMilliseconds from that... but I've heard it isn't perfectly accurate. Is there an ...