X-Git-Url: http://pileus.org/git/?p=aweather;a=blobdiff_plain;f=src%2Fmain.c;h=3c2e57b381b00fcadb218e651594c1d3eb94fca2;hp=6d335af60e33c2bd83fdbd7ecef018a955a44d72;hb=2f49abcf87f8a16bab10bc485ec0cd95c535091f;hpb=0b22be9563d7fd7b63294b5cffb1954726b933ff diff --git a/src/main.c b/src/main.c index 6d335af..3c2e57b 100644 --- a/src/main.c +++ b/src/main.c @@ -58,9 +58,9 @@ static void set_location_time(AWeatherGui *gui, char *site, char *time) /* Set time * Do this before setting setting location * so that it doesn't refresh twice */ - struct tm tm = {}; - strptime(time, "%Y-%m-%d %H:%M", &tm); - time_t sec = mktime(&tm); + int year, mon, day, hour, min; + sscanf(time, "%d-%d-%d %d:%d", &year, &mon, &day, &hour, &min); + time_t sec = mktime(&(struct tm){0, year-1900, mon-1, day, hour, min}); if (sec > 0) grits_viewer_set_time(gui->viewer, sec); g_debug("date = [%s] == %lu\n", time, sec);