|
Boost Users : |
Subject: [Boost-users] date_time O/S conversion routine limitation
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-11-01 01:12:48
Hello list,
Apologies for the cross-post, this originally went to the boost-users list a
day or so ago but it got no responses, and then I also realized it was
actually more appropriate here.
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? I mean, a FILETIME
is really just a uint64, can't the templated function also just operate on a
boost::uint64_t?
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