summaryrefslogtreecommitdiff
path: root/ACE/ace/Log_Record.cpp
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2010-12-02 20:14:56 +0000
committerSteve Huston <shuston@riverace.com>2010-12-02 20:14:56 +0000
commite0f68e00987eabe3916a2d117b33ac4ce747bb1c (patch)
treec63c038d0714eab7a384df76f531f75f879b830f /ACE/ace/Log_Record.cpp
parent06d606acee020bac9ab442f125c69388e363c541 (diff)
downloadATCD-e0f68e00987eabe3916a2d117b33ac4ce747bb1c.tar.gz
ChangelogTag:Thu Dec 2 18:29:36 UTC 2010 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ACE/ace/Log_Record.cpp')
-rw-r--r--ACE/ace/Log_Record.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp
index b562103532b..fb7ae019708 100644
--- a/ACE/ace/Log_Record.cpp
+++ b/ACE/ace/Log_Record.cpp
@@ -214,18 +214,16 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
u_long verbose_flag,
ACE_TCHAR *verbose_msg)
{
- /* 0123456789012345678901234 */
- /* Oct 18 14:25:36.000 1989<nul> */
- ACE_TCHAR timestamp[26]; // Only used by VERBOSE and VERBOSE_LITE.
+ /* 012345678901234567890123456 */
+ /* yyyy-mm-dd hh:mm:ss.mmmmmm<nul> */
+ ACE_TCHAR timestamp[27]; // Only used by VERBOSE and VERBOSE_LITE.
// The sprintf format needs to be different for Windows and POSIX
// in the wide-char case.
#if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
- const ACE_TCHAR *time_fmt = ACE_TEXT ("%s.%03ld %s");
const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%s@%s@%u@%s@%s");
const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%s@%s@%s");
#else
- const ACE_TCHAR *time_fmt = ACE_TEXT ("%ls.%03ld %ls");
const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%ls@%ls@%u@%ls@%ls");
const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%ls@%ls@%ls");
#endif
@@ -235,23 +233,10 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[],
|| ACE_BIT_ENABLED (verbose_flag,
ACE_Log_Msg::VERBOSE_LITE))
{
- time_t const now = this->secs_;
- ACE_TCHAR ctp[26]; // 26 is a magic number...
-
- if (ACE_OS::ctime_r (&now, ctp, sizeof ctp / sizeof (ACE_TCHAR)) == 0)
- return -1;
-
- /* 01234567890123456789012345 */
- /* Wed Oct 18 14:25:36 1989n0 */
-
- ctp[19] = '\0'; // NUL-terminate after the time.
- ctp[24] = '\0'; // NUL-terminate after the date.
-
- ACE_OS::sprintf (timestamp,
- time_fmt,
- ctp + 4,
- ((long) this->usecs_) / 1000,
- ctp + 20);
+ ACE_Time_Value now (this->secs_, this->usecs_);
+ ACE::timestamp (now, timestamp, 27);
+ // Historical timestamp in VERBOSE[_LITE] used 3 places for partial sec.
+ timestamp[23] = '\0';
}
if (ACE_BIT_ENABLED (verbose_flag,