Overview
Features
Download
Documentation
Community
Add-Ons & Services

TimeStamp problem

A general discussion forum.

TimeStamp problem

Postby boa » 15 Mar 2011, 13:25

Hi everybody!
i'm a newbie in the Poco and i have problem with TimeStamp and logging
my porblem is next: when i take a new Timestamp and then print out it on console, i see that it shows me time at zero timezone
but i want to see timestamp at timezone +3
what should i do for that?

And next question also about timezones. I create and use a logger in next way:

Code: Select all
FormattingChannel* pFCFile_501 = new FormattingChannel(new PatternFormatter("[%Y-%m-%d %H:%M:%S.%c] [%P:%q] %t"));
pFCFile_501->setChannel(new FileChannel( (log_path + string("501.log")).c_str() ));
pFCFile_501->open();
AsyncChannel* pAsync_501 = new AsyncChannel(pFCFile_501);
Logger::create("501", pAsync_501, Message::PRIO_ERROR);


It works good, but it puts in logfile a logentry with datetime of zero timezone. I looked in doc and presentations and couldnt find how to change timezone to +3
what should i do for that?
boa
 
Posts: 1
Joined: 15 Mar 2011, 13:09

Re: TimeStamp problem

Postby guenter » 16 Mar 2011, 09:02

Create a Poco::LocalDateTime from the Poco::Timestamp to get a local date/time.
For logging, set the PatternFormatter's "times" property to "local":

Code: Select all
Poco::PatternFormatter pPF = new Poco::PatternFormatter("[%Y-%m-%d %H:%M:%S.%c] [%P:%q] %t");
pPF->setProperty("times", "local");
guenter
 
Posts: 1110
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron