boost-date-time

Howto format a boost::date_time-object as per RFC 3339

I want to use the date_time library in boost to represent time in my application. This application will generate Atom feeds, which in turn mandates time-stamps in the format specified in RFC 3339, for example "1990-12-31T23:59:60Z" or "1990-12-31T15:59:60-08:00". So, how do I format time according to this RFC? I have been reading the D...

unix timestamp to boost::posix_time::ptime

I need to convert double with number of seconds since the epoch to ptime. I'm prety sure there must be an easy way to do this, but I couldn't find anything. Thanks. Edit: The original timestamp is floating point. I can't change it and i don't want to lose the sub-second precision. ...

How to initialize a Boost date?

The page http://www.boost.org/doc/libs/1_42_0/doc/html/date_time/gregorian.html#date_construction explains that you can initialize a Boost date with this kind of call: date d(2002, Jan, 10); But when I try that, the compiler doesn't know 'Jan'. It does work with: date d(2002, 1, 10); EDIT: #include <boost/date_time/gregorian/gr...

basic boost date_time input format question

I've got a pointer to a string, (char *) as input. The date/time looks like this: Sat, 10 Apr 2010 19:30:00 I'm only interested in the date, not the time. I created an "input_facet" with the format I want: boost::date_time::date_input_facet inFmt("%a %d %b %Y"); but I'm not sure what to do with it. Ultimately I'd like to create a date...

Simplest way to get current time in current timezone using boost::date_time ?

If I do date +%H-%M-%S on the commandline (Debian/Lenny), I get a user-friendly (not UTC, not DST-less, the time a normal person has on their wristwatch) time printed. What's the simplest way to obtain the same thing with boost::date_time ? If I do this: std::ostringstream msg; boost::local_time::local_date_time t = boost::local_t...

Use boost date_time to parse and create HTTP-dates

I'm writing a kind of HTTP proxy, so I need to be able to do 3 things: Parse an HTTP-date given any of the 3 formats specified in RFC 2616, sec 3.3, Convert a file date-time to an HTTP-date string, and Output the date to a string. For reference, theses are examples of the date-times I need to parse. I will output only the first form...

Boost::Date from_simple_string performance

After profiling some code I've found boost::gregorian::from_simple_string to be inefficient in loops with many iterations. Instruction read counts from using this function seem to be inordinately high. I've tried the locale/facets + stringstream method discussed in this thread but followup profiling didn't show any noticeable improvement...

boost::gregorian::date

I can't get it to work with visual c++ 2005 and boost 1.43 this simple source code : #include <boost/date_time.hpp> int main( int argc, char** argv ) { boost::gregorian::date d(); } gives a link-time error : error LNK2019: unresolved external symbol "class boost::gregorian::date __cdecl d(void)" (?d@@YA?AVdate@gregorian@boost...

parsing of date/time from string (boost?)

I'm kinda stuck with parsing of date/time strings. Help would be greatly appreciated. Input: strings with date and optional time. Different representations would be nice but necessary. The strings are user-supplied and can be malformed. Examples: - "2004-03-21 12:45:33" (I consider this the default layout) - "2004/03/21 12:45:33" (o...

How do I get the current UTC offset (time zone)?

How do I get the current UTC offset (as in time zone, but just the UTC offset of the current moment)? I need an answer like "+02:00". ...

Performance of dynamic_cast?

Before reading the question: This question is not about how useful it is to use dynamic_cast. Its just about its performance. I've recently developed a design where dynamic_cast is used a lot. When discussing it with co-workers almost everyone says that dynamic_cast shouldn't be used because of its bad performance (these are co-workers ...