From a C++ app. compiled for AIX, HP-UX, Linux, OSX and Solaris is there a simple way to determine whether the app. is running within 5 minutes of system boot?
On Windows I can do this:
// return true if OS has recently booted up
bool at_os_boot_time()
{
/* GetTickCount() returns the number of miliseconds since system start.
So "...the time will wrap around to zero if the system is run
continuously for 49.7 days" - so this function will erroneously
return true for a 5 minute period 49.7 days after boot */
return ::GetTickCount() < 5 * 60 * 1000;
}
I can't find the equivalent in the Unix world.