Archived

This topic is now archived and is closed to further replies.

Kylotan

Reverse of 'ctime' function

Recommended Posts

Kylotan    10013
Just as ctime takes a time_t and returns a char*, is there an equivalent function anywhere that will take a char* that is supposedly the output of a time_t, and return the appropriate time_t? I''d think there''d be something like this in a mail package, but I''ve not found one yet. There seems to be a ''strptime'' in some implementations which returns a ''struct tm'' that I could probably use, but does anyone have anything better? I am aware there may be locale issues here, too. [ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

Share this post


Link to post
Share on other sites
dorix    484
If you''re not too averse to using strptime (locale issues aside) to get a struct tm*, then you can use mktime to get a time_t out of that.

- dorix

Share this post


Link to post
Share on other sites