From 9c16019f62947e30aa00aa6ac2a15b67cdf48882 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 2 Oct 2007 09:37:41 +0000 Subject: [PATCH] Patch by Rene Gollent which fixes displaying of current time. I've used snprintf instead of sprintf and reduced the size of the char array, though. Hope you don't mind, Rene. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22406 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/TZDisplay.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/preferences/time/TZDisplay.cpp b/src/preferences/time/TZDisplay.cpp index f68ef77162..80fcecedf1 100644 --- a/src/preferences/time/TZDisplay.cpp +++ b/src/preferences/time/TZDisplay.cpp @@ -9,6 +9,8 @@ * */ +#include + #include "TZDisplay.h" @@ -125,8 +127,10 @@ TTZDisplay::SetTime(int32 hour, int32 minute) if (hour > 11) ap = "PM"; - fTime.SetTo(""); - fTime << ahour << ":" << minute << ":" << ap; + char buffer[32]; + snprintf(buffer, sizeof(buffer), "%ld:%02ld %s", ahour, minute, ap); + + fTime.SetTo(buffer); Invalidate(); }