-static time_t __media_svc_get_timeline_from_str(const char *timstr)
-{
- struct tm t;
- time_t modified_t = 0;
- time_t rawtime;
- struct tm timeinfo;
-
- if (!STRING_VALID(timstr)) {
- media_svc_error("Invalid Parameter");
- return 0;
- }
-
- /*Exif Format : %Y:%m:%d %H:%M:%S
- Videoc Content Creation_time format of FFMpeg : %Y-%m-%d %H:%M:%S*/
- memset(&t, 0x00, sizeof(struct tm));
-
- tzset();
- time(&rawtime);
- localtime_r(&rawtime, &timeinfo);
-
- if (strptime(timstr, "%Y:%m:%d %H:%M:%S", &t) || strptime(timstr, "%Y-%m-%d %H:%M:%S", &t)) {
- t.tm_isdst = timeinfo.tm_isdst;
- if (t.tm_isdst != 0)
- media_svc_debug("DST %d", t.tm_isdst);
-
- /* 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)) {
- char tim_tmp_str[255] = { 0, };
-
- /* ISO8601 Time string format */
- strftime(tim_tmp_str, 255, "%Y-%m-%dT%H:%M:%S%z", &t);
- 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);
- }
-
- if (modified_t > 0)
- return modified_t;
- else
- media_svc_debug("Failed to get timeline : [%s] [%d:%d:%d: %d:%d:%d]", timstr, t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
- } else {
- media_svc_error("Failed to get timeline : [%s]", timstr);
- }
-
- return 0;
-}
-