]> git.tdb.fi Git - libs/core.git/blob - source/core/windows/systemerror.cpp
Add conversion from RFC3339 string to DateTime
[libs/core.git] / source / core / windows / systemerror.cpp
1 #include <windows.h>
2 #include <msp/strings/lexicalcast.h>
3 #include "systemerror.h"
4
5 using namespace std;
6
7 namespace Msp {
8 string system_error::get_message(int c)
9 {
10         if(c==-1)
11                 c = GetLastError();
12
13         char msg[1024];
14         if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, c, 0, msg, sizeof(msg), 0))
15                 return msg;
16         else
17                 return lexical_cast<string>(c, Fmt().hex());
18 }
19
20 } // namespace Msp