* 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:
@@ -306,13 +306,6 @@ TTimeView::StopLongClickNotifier()
|
|||||||
void
|
void
|
||||||
TTimeView::GetCurrentTime()
|
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);
|
fLocale.FormatTime(fTimeStr, 64, fTime, fShowSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +383,10 @@ void
|
|||||||
TTimeView::Pulse()
|
TTimeView::Pulse()
|
||||||
{
|
{
|
||||||
time_t curTime = time(NULL);
|
time_t curTime = time(NULL);
|
||||||
tm ct = *localtime(&curTime);
|
tm* ct = localtime(&curTime);
|
||||||
|
if (ct == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
fTime = curTime;
|
fTime = curTime;
|
||||||
|
|
||||||
GetCurrentTime();
|
GetCurrentTime();
|
||||||
@@ -417,10 +413,10 @@ TTimeView::Pulse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fNeedToUpdate) {
|
if (fNeedToUpdate) {
|
||||||
fSeconds = ct.tm_sec;
|
fSeconds = ct->tm_sec;
|
||||||
fMinute = ct.tm_min;
|
fMinute = ct->tm_min;
|
||||||
fHour = ct.tm_hour;
|
fHour = ct->tm_hour;
|
||||||
fInterval = ct.tm_hour >= 12;
|
fInterval = ct->tm_hour >= 12;
|
||||||
|
|
||||||
Draw(Bounds());
|
Draw(Bounds());
|
||||||
fNeedToUpdate = false;
|
fNeedToUpdate = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user