Use g_date_time_new_from_iso8601() instead 84/236784/2
authorMinje Ahn <minje.ahn@samsung.com>
Mon, 22 Jun 2020 05:34:21 +0000 (14:34 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Mon, 22 Jun 2020 06:07:29 +0000 (15:07 +0900)
g_time_val_from_iso8601 has been deprecated since version 2.62 and should not be used in newly-written code.
GTimeVal is not year-2038-safe. Use g_date_time_new_from_iso8601() instead.

Change-Id: I7835be133dd868d8fafc3f90e52f2ecafc295020
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/common/media-svc-util.c

index 2da5c75..84c54cc 100644 (file)
@@ -318,14 +318,15 @@ static time_t __media_svc_get_timeline_from_str(const char *timstr)
 
                /* If time string has timezone */
                if (strptime(timstr, "%Y:%m:%d %H:%M:%S %z", &t) || strptime(timstr, "%Y-%m-%d %H:%M:%S %z", &t)) {
-                       GTimeVal timeval;
                        char tim_tmp_str[255] = { 0, };
 
                        /* ISO8601 Time string format */
                        strftime(tim_tmp_str, 255, "%Y-%m-%dT%H:%M:%S%z", &t);
-                       g_time_val_from_iso8601(tim_tmp_str, &timeval);
-                       modified_t = timeval.tv_sec;
-                       media_svc_debug("Calibrated timeval : [%lu][%s]", modified_t, tim_tmp_str);
+                       GDateTime *pdatetime = g_date_time_new_from_iso8601(tim_tmp_str, NULL);
+                       if (pdatetime)
+                               modified_t = g_date_time_to_unix(pdatetime);
+                       g_date_time_unref(pdatetime);
+                       media_svc_debug("Calibrated timeval : [%ld][%s]", modified_t, tim_tmp_str);
                } else {
                        /* Just localtime */
                        modified_t = mktime(&t);