Suppose I have a cross-platform agent that communicates with a server. Agent from platform X sends a message to the server which contains a date/time. Server sends a message to another agent running platform Y with the same date/time. In practice X/Y are always either windows/linux or linux/windows. The server always tells the agent which platform's native format the time is represented in, so there should be no problem. Ideally I'd like to write the following code:
ptime time;
if (msg.is_from_windows())
{
time = from_ftime<ptime>(msg.time());
}
else
{
time = from_time_t(msg.time());
}
But this doesn't work because from_ftime<> is not defined on linux. If from_ftime<> is already templated on the FILETIME type, is there any reason it needs to be #ifdef'd out on non-windows platforms? Or does someone maybe have another solution to being able to support the use-case I've mentioned above?
Zach