{
time_t t = (value / 10000000LL) - 11644473600LL;
struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
- buf[0] = '\0';
+ if (!tm)
+ return -1;
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
++ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
+ return 0;
}
/**
{
time_t t = (value / 10000000LL) - 719162LL*86400LL;
struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
- buf[0] = '\0';
+ if (!tm)
+ return -1;
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
++ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
+ return 0;
}
/**
* Convert OLE DATE to ISO-8601 string
+ * @return <0 on error
*/
-static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
+static int oledate_to_iso8601(char *buf, int buf_size, int64_t value)
{
- time_t t = 631112400LL + 86400*av_int2double(value);
- struct tm *tm = gmtime(&t);
- if (tm)
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
- else
- buf[0] = '\0';
+ time_t t = (av_int2double(value) - 25569.0) * 86400;
- struct tm *result= gmtime(&t);
- if (!result)
++ struct tm *tm= gmtime(&t);
++ if (!tm)
+ return -1;
- strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", result);
++ strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", tm);
+ return 0;
}
static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)