diff options
author | Minje Ahn <minje.ahn@samsung.com> | 2020-06-22 14:34:21 +0900 |
---|---|---|
committer | Minje Ahn <minje.ahn@samsung.com> | 2020-06-22 15:07:29 +0900 |
commit | 15422b384e51948a514595353a63374be94a9806 (patch) | |
tree | 89c2e939648f30d3719ac3191e5d4637d909bec0 | |
parent | a38c6fdabcbf4483e343d927526e2052de4c4050 (diff) | |
download | libmedia-service-15422b384e51948a514595353a63374be94a9806.tar.gz libmedia-service-15422b384e51948a514595353a63374be94a9806.tar.bz2 libmedia-service-15422b384e51948a514595353a63374be94a9806.zip |
Use g_date_time_new_from_iso8601() instead
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>
-rw-r--r-- | src/common/media-svc-util.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/media-svc-util.c b/src/common/media-svc-util.c index 2da5c75..84c54cc 100644 --- a/src/common/media-svc-util.c +++ b/src/common/media-svc-util.c @@ -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); |