|
Boost Users : |
Subject: [Boost-users] Cross-platform date/time problems
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-10-30 17:52:59
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net