$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Aljaz (aljaz.fajmut_at_[hidden])
Date: 2007-05-15 09:00:11
Hello
I want to output current date/time on my computer including timezone in this 
format:
Date: Tue, 15 May 2007 09:21:48 -0400
-0400 is a timezone
Im not really familiar with timezones and I could not understand the 
documentation how to output local timezone this way.
Basically I just want to output local timezone on computer..
Heres what I have so far:
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/local_time/posix_time_zone.hpp>
#include <boost/date_time/date_facet.hpp>
#include <ctime>
#include <locale>
#include <memory>
#include <sstream>
#include <boost/shared_ptr.hpp>
std::string mystrftime(const std::string format, time_t time,
        const std::locale& locale = std::locale::classic()) {
 boost::shared_ptr<boost::local_time::time_zone> tz(new 
boost::local_time::posix_time_zone("dont know what to put here"));
 boost::local_time::local_date_time dt(boost::posix_time::from_time_t(time), 
tz);
 boost::local_time::local_time_facet *ff = new 
boost::local_time::local_time_facet();
 ff->format(format.c_str());
 std::stringstream s;
 s.imbue(std::locale(std::locale::classic(), ff));
 s << dt;
 return s.str();
}
int main () {
 std::cout << mystrftime("%A, %B %d, %Y %q", std::time(0)) << '\n';
}
Thanks for help
Regards
A