dimanche 31 juillet 2016

how to parse a date time string that includes fractional time

I have a datetime string as : "20:48:01.469 UTC MAR 31 2016", I would like to convert this string representation of time to a time tm structure using strptime, but my format string apears wrong. What should I use for fractional seconds? %S or %s or aomething else? Please advise. Code snippet is as below:

tm tmbuf;
const char *str = "20:48:01.469 UTC MAR 31 2016"
const char *fmt = "%H:%M:%s %Z %b %d %Y";
strptime(str,fmt,&tmbuf);

Aucun commentaire:

Enregistrer un commentaire