Reverse of 'ctime' function
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 ]
You have the std::time_get facet class in the <locale> header.
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
Hmm, might be useful. I''d prefer something in C but I may be able to use that instead, so thanks.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
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
- dorix
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement