1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <time.h> #include <stdio.h> #include <stdlib.h> int main(void) { time_t curtime; struct tm* utctime; double swatchTime; curtime = time(NULL); utctime = gmtime(&curtime); swatchTime = (((utctime->tm_hour + 1) % 24) * 60 + utctime->tm_min) * 60 + utctime->tm_sec; swatchTime /= 84.6; printf("%3.2f", swatchTime); return EXIT_SUCCESS; }