* removed some useless code and protect against localtime() possibly returning

NULL

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2010-08-16 14:59:14 +00:00
parent 559cf371bc
commit 795ff7d3d4
+8 -12
View File
@@ -306,13 +306,6 @@ TTimeView::StopLongClickNotifier()
void
TTimeView::GetCurrentTime()
{
// TODO : should this be another function ?
tm time = *localtime(&fTime);
fSeconds = time.tm_sec;
fMinute = time.tm_min;
fHour = time.tm_hour;
fLocale.FormatTime(fTimeStr, 64, fTime, fShowSeconds);
}
@@ -390,7 +383,10 @@ void
TTimeView::Pulse()
{
time_t curTime = time(NULL);
tm ct = *localtime(&curTime);
tm* ct = localtime(&curTime);
if (ct == NULL)
return;
fTime = curTime;
GetCurrentTime();
@@ -417,10 +413,10 @@ TTimeView::Pulse()
}
if (fNeedToUpdate) {
fSeconds = ct.tm_sec;
fMinute = ct.tm_min;
fHour = ct.tm_hour;
fInterval = ct.tm_hour >= 12;
fSeconds = ct->tm_sec;
fMinute = ct->tm_min;
fHour = ct->tm_hour;
fInterval = ct->tm_hour >= 12;
Draw(Bounds());
fNeedToUpdate = false;