jeudi 17 août 2017

convert data/time to tm/time_point against musl and glibc. Common way

I would like to convert string data to struct tm (c) or std::chrono::time_point. The problem is I wanna working solution for both standard libc (glibc and musl). I have tree standard formats that I wanna parse.

  1. RFC-1123

    Sun, 06 Nov 1994 08:49:37 GMT

  2. RFC-850

    "Sunday, 06-Nov-94 08:49:37 GMT"

  3. ANSI C's asctime format

    Sun Nov 6 08:49:37 1994"

Is there any way to make it work? std::get_time has a bug
strptime work fine (and quick) on glibc but fail against musl.

Any idea? I don't wanna use stream like in get_time. But If it would be necessary that fine. (It's ok to use GCC5> and c++11 standard)

Aucun commentaire:

Enregistrer un commentaire