i am using function
gethrtime() in sun solaries
to get the time independent of the system time.Problem with this function is if we restart the system time will change to '0'.is there any other way to resolve this problem.
thanks & regards
suresh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are you sure that you are on the right forum? This one is related to C/C++ development using Dev-C++ a Windows based IDE primarily for use with the MinGW/GCC compiler. Since Dev-C++ does not run on Solaris, methinks you are a bit lost. You might try http://forums.devshed.com/c-programming-42/
gethrtime() is not related to time/date; its start point is arbitrary. It returns a signed long long value representing nanoseconds, assuming that this 64bit on Solaris, that is good for about +/-292 years. One solution would be to calculate the system clock time in nanoseconds since the start of epoc, and then use that value as an offset to the value returned by gethrtime(). If you do that, you will of course loose some accuracy, but it is unlikely that you need that much precision between runs, if you do then the solution is never to switch the system off! You will at least be able to relate timestamps from different power-cycles with some degree of accuracy, but I would not like to guarantee it to more than a few seconds between cycles.
I have to say however that if you need high resolution 'clock time' between power cycles I would question your design or intent. You may be attempting the impossible!
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i am using function
gethrtime() in sun solaries
to get the time independent of the system time.Problem with this function is if we restart the system time will change to '0'.is there any other way to resolve this problem.
thanks & regards
suresh
Are you sure that you are on the right forum? This one is related to C/C++ development using Dev-C++ a Windows based IDE primarily for use with the MinGW/GCC compiler. Since Dev-C++ does not run on Solaris, methinks you are a bit lost. You might try http://forums.devshed.com/c-programming-42/
gethrtime() is not related to time/date; its start point is arbitrary. It returns a signed long long value representing nanoseconds, assuming that this 64bit on Solaris, that is good for about +/-292 years. One solution would be to calculate the system clock time in nanoseconds since the start of epoc, and then use that value as an offset to the value returned by gethrtime(). If you do that, you will of course loose some accuracy, but it is unlikely that you need that much precision between runs, if you do then the solution is never to switch the system off! You will at least be able to relate timestamps from different power-cycles with some degree of accuracy, but I would not like to guarantee it to more than a few seconds between cycles.
I have to say however that if you need high resolution 'clock time' between power cycles I would question your design or intent. You may be attempting the impossible!
Clifford