From 39d7d2fe560c8a248962de692ee325e7fdedce4b Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 1 Jun 2014 11:42:11 +0000 Subject: [PATCH] on getting time, fixed DST handling from "no dst" to "autodetect" on setting time, push local time to remote currently git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14969 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 7f81512ba..21a29c33c 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -5050,6 +5050,7 @@ _get_STR_as_time(CONFIG_GET_ARGS) { strncpy (tmp, capture_date + 13, 2); tmp[2] = 0; tm.tm_sec = atoi (tmp); + tm.tm_isdst = -1; /* autodetect */ camtime = mktime(&tm); gp_widget_set_value (*widget,&camtime); return (GP_OK); @@ -5070,9 +5071,10 @@ _put_STR_as_time(CONFIG_PUT_ARGS) { if (ret != GP_OK) return ret; #ifdef HAVE_GMTIME_R - pxtm = gmtime_r (&camtime, &xtm); + memset(&xtm,0,sizeof(xtm)); + pxtm = localtime_r (&camtime, &xtm); #else - pxtm = gmtime (&camtime); + pxtm = localtime (&camtime); #endif /* 20020101T123400.0 is returned by the HP Photosmart */ sprintf(asctime,"%04d%02d%02dT%02d%02d%02d.0",pxtm->tm_year+1900,pxtm->tm_mon+1,pxtm->tm_mday,pxtm->tm_hour,pxtm->tm_min,pxtm->tm_sec);