X-Git-Url: http://pileus.org/git/?p=aweather;a=blobdiff_plain;f=src%2Fmain.c;h=3c2e57b381b00fcadb218e651594c1d3eb94fca2;hp=89eeda7b9f552e093ac8aecaf5840a6b7b4f34d3;hb=2f49abcf87f8a16bab10bc485ec0cd95c535091f;hpb=d1e3f70aff8abe0dd288f5debbec86e38e20571c diff --git a/src/main.c b/src/main.c index 89eeda7..3c2e57b 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 Andy Spencer + * Copyright (C) 2009-2011 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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);