RichardFerraro
Well-known member
Anyone have an algorithm to calculate the current month-day-year based on the number of seconds since Jan 1, 1970 as provided by time.nist.gov NTP server.
I can correctly calculate the local time (hour-min-second)
secsSince1970 = secsSince1900 - 2208988800; // subtract seconds in seventy years:
hour = (secsSince1970 % SECONDS_IN_DAY) / SECONDS_IN_HOUR); // hour (86400 equals secs per day)
min = (secsSince1970 % SECONDS_IN_DAY) / SECONDS_IN_HOUR;
seconds = (secsSince1970 % SECONDS_IN_HOUR) / SECONDS_IN_MINUTE);
e.g. results,
Seconds since Jan 1 1900 = 3856635732
The UTC time is 23:42:12
The California time is 16:42:16
I can't figure out how to get the date. I have tried two algorithms I found on-line and neither is even close.
thanks,
Richie
Does anyone really know what time it is? (music by Chicago)
I can correctly calculate the local time (hour-min-second)
secsSince1970 = secsSince1900 - 2208988800; // subtract seconds in seventy years:
hour = (secsSince1970 % SECONDS_IN_DAY) / SECONDS_IN_HOUR); // hour (86400 equals secs per day)
min = (secsSince1970 % SECONDS_IN_DAY) / SECONDS_IN_HOUR;
seconds = (secsSince1970 % SECONDS_IN_HOUR) / SECONDS_IN_MINUTE);
e.g. results,
Seconds since Jan 1 1900 = 3856635732
The UTC time is 23:42:12
The California time is 16:42:16
I can't figure out how to get the date. I have tried two algorithms I found on-line and neither is even close.
thanks,
Richie
Does anyone really know what time it is? (music by Chicago)