mirror of https://github.com/BOINC/boinc.git
MGR: Work around a wxCocoa bug(?) in wxDateTime::Format()
This commit is contained in:
parent
b9a7314020
commit
c7fd0a3687
|
@ -38,6 +38,9 @@
|
|||
#include "AdvancedFrame.h"
|
||||
#include <wx/display.h>
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
////@begin includes
|
||||
////@end includes
|
||||
|
@ -994,12 +997,20 @@ wxInt32 CDlgEventLog::FormatProjectName(wxInt32 item, wxString& strBuffer) const
|
|||
|
||||
|
||||
wxInt32 CDlgEventLog::FormatTime(wxInt32 item, wxString& strBuffer) const {
|
||||
wxDateTime dtBuffer;
|
||||
MESSAGE* message = wxGetApp().GetDocument()->message(item);
|
||||
|
||||
if (message) {
|
||||
#ifdef __WXMAC__
|
||||
// Work around a wxCocoa bug(?) in wxDateTime::Format()
|
||||
char buf[80];
|
||||
struct tm * timeinfo = localtime((time_t*)&message->timestamp);
|
||||
strftime(buf, sizeof(buf), "%c", timeinfo);
|
||||
strBuffer = buf;
|
||||
#else
|
||||
wxDateTime dtBuffer;
|
||||
dtBuffer.Set((time_t)message->timestamp);
|
||||
strBuffer = dtBuffer.Format();
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1163,10 +1163,18 @@ void CViewWork::GetDocReportDeadline(wxInt32 item, time_t& time) const {
|
|||
|
||||
|
||||
wxInt32 CViewWork::FormatReportDeadline(time_t deadline, wxString& strBuffer) const {
|
||||
#ifdef __WXMAC__
|
||||
// Work around a wxCocoa bug(?) in wxDateTime::Format()
|
||||
char buf[80];
|
||||
struct tm * timeinfo = localtime(&deadline);
|
||||
strftime(buf, sizeof(buf), "%c", timeinfo);
|
||||
strBuffer = buf;
|
||||
#else
|
||||
wxDateTime dtTemp;
|
||||
|
||||
dtTemp.Set(deadline);
|
||||
strBuffer = dtTemp.Format();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue