[Moved] QdateTime
-
I am trying to convert a C# program that use Datetime class.
The precision on this class in C# is in tick - equivalent to 0.1 micro second .
Has anybody done some work on Qdatetime to inherit this class and modify the api to be able to handle this precision?
Is this the best way to start? -
QDateTime wasn't really written to be extensible, I am afraid, so subclassing QDateTime doesn't sound like a promising approach. You may have to write your own TickDateTime class. Please also notice that not all platforms support such granularity (one reason that QDateTime is based on milliseconds is that that is a granularity that all platforms supported by Qt these days support themselves).
-
[quote author="kalle" date="1286803210"]Please also notice that not all platforms support such granularity (one reason that QDateTime is based on milliseconds is that that is a granularity that all platforms supported by Qt these days support themselves).[/quote]
I find this limitation a bit surprising. Java introduced the nanoTime() call in JDK 1.5 and claims to try to get the system time in nano seconds (though not fully accurate), there must be some way to do this in Qt. IMHO millis is really quite limited !!!
-
In microsecond yes, have run into “0” ms time taken for many methods while measuring performance.
It means you have no to do with these methods optimization, do you?. Besides you should use appropriate software for profiling instead of using custom non-precise methods.
0.1 microsecond = 1 nanosecond
1 microsecond = 10^-6
1 nanosecond = 10^-9
0.1 microsecond != 1 nanosecond
Is this the best way to start?
I think it is better to use platform-dependent methods when you really need such a precision without any Qt wrapping.