summaryrefslogtreecommitdiffstats
path: root/media-gfx/exiv2/files/exiv2-0.21.1-offby1time-fix.patch
blob: c90298ab6276d2df9f864db479b91d9424680b96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Index: trunk/src/actions.cpp
===================================================================
--- trunk/src/actions.cpp	(revision 2474)
+++ trunk/src/actions.cpp	(revision 2475)
@@ -104,11 +104,11 @@
      */
     int str2Tm(const std::string& timeStr, struct tm* tm);
 
-    //! Convert a UTC time to a string "YYYY:MM:DD HH:MI:SS", "" on error
+    //! Convert a localtime to a string "YYYY:MM:DD HH:MI:SS", "" on error
     std::string time2Str(time_t time);
 
     //! Convert a tm structure to a string "YYYY:MM:DD HH:MI:SS", "" on error
-    std::string tm2Str(struct tm* tm);
+    std::string tm2Str(const struct tm* tm);
 
     /*!
       @brief Copy metadata from source to target according to Params::copyXyz
@@ -1565,7 +1565,7 @@
                       << " " << _("years") << "\n";
             return 1;
         }
-        time_t time = timegm(&tm);
+        time_t time = mktime(&tm);
         time += adjustment_ + dayAdjustment_ * 86400;
         timeStr = time2Str(time);
         if (Params::instance().verbose_) {
@@ -1739,7 +1739,7 @@
     int Timestamp::read(struct tm* tm)
     {
         int rc = 1;
-        time_t t = mktime(tm);
+        time_t t = mktime(tm); // interpret tm according to current timezone settings
         if (t != (time_t)-1) {
             rc = 0;
             actime_  = t;
@@ -1783,22 +1783,18 @@
         tm->tm_sec = tmp;
 
         // Conversions to set remaining fields of the tm structure
-        time_t time = timegm(tm);
-#ifdef EXV_HAVE_GMTIME_R
-        if (time == (time_t)-1 || gmtime_r(&time, tm) == 0) return 11;
-#else
-        if (time == (time_t)-1 || std::gmtime(&time)  == 0) return 11;
-#endif
+        if (mktime(tm) == (time_t)-1) return 11;
+
         return 0;
     } // str2Tm
 
     std::string time2Str(time_t time)
     {
-        struct tm* tm = gmtime(&time);
+        struct tm* tm = localtime(&time);
         return tm2Str(tm);
     } // time2Str
 
-    std::string tm2Str(struct tm* tm)
+    std::string tm2Str(const struct tm* tm)
     {
         if (0 == tm) return "";