/* Program by Christopher Nafis Written October 2004 Copyright 2004 Set the weatherstation date / time in UTC */ #class auto int main() { struct tm rtc; char line[80]; char *endptr; tm_rd(&rtc); printf("The Current date is: %02d/%02d/%04d\n", rtc.tm_mon, rtc.tm_mday, 1900+rtc.tm_year); printf("The Current time is: %02d:%02d:%02d UTC\n", rtc.tm_hour, rtc.tm_min, rtc.tm_sec); printf("Enter month (1-12):\n"); gets(line); rtc.tm_mon = (unsigned int)strtod(line, &endptr); printf("Enter day (1-31):\n"); gets(line); rtc.tm_mday = (unsigned int)strtod(line, &endptr); printf("Enter year (2004-2047):\n"); gets(line); rtc.tm_year = (unsigned int)strtod(line, &endptr) - 1900; printf("Enter hour (0-23):\n"); gets(line); rtc.tm_hour = (unsigned int)strtod(line, &endptr); printf("Enter minute (0-59):\n"); gets(line); rtc.tm_min = (unsigned int)strtod(line, &endptr); printf("Enter seconds (0-59):\n"); gets(line); rtc.tm_sec = (unsigned int)strtod(line, &endptr); tm_wr(&rtc); }