fixed missing IPhonePlatform::TimeString

This commit is contained in:
rachytski 2011-04-30 01:35:32 +03:00 committed by Alex Zolotarev
parent 1e6b8c8162
commit 7c5cc9e40e
5 changed files with 27 additions and 8 deletions

View file

@ -103,9 +103,10 @@
GetPlatform().ReadPathForFile("fonts_whitelist.txt").c_str(),
GetPlatform().ReadPathForFile("fonts_blacklist.txt").c_str(),
2000000,
fmt));
fmt,
false));
resourceManager->addFonts(GetPlatform().GetFontNames());
DrawerYG::params_t p;

View file

@ -7,7 +7,7 @@ class IPhonePlatform : public Platform
{
public:
IPhonePlatform();
virtual ~IPhonePlatform() {}
virtual ~IPhonePlatform();
virtual double TimeInSec() const;
virtual string WritableDir() const;
virtual string ReadPathForFile(char const * file) const;
@ -24,13 +24,15 @@ public:
virtual bool IsBenchmarking() const;
virtual bool IsVisualLog() const;
virtual string const DeviceID() const;
virtual string const TimeString() const;
virtual unsigned ScaleEtalonSize() const;
private:
string m_deviceID;
string m_skinName;
double m_visualScale;
NSDate * m_StartDate;
NSDate * m_startDate;
NSDateFormatter * m_dateFormatter;
bool m_isMultiSampled;
bool m_doPeriodicalUpdate;
double m_periodicalUpdateInterval;

View file

@ -26,7 +26,9 @@ IPhonePlatform::IPhonePlatform()
m_writablePath = [docsDir UTF8String];
m_writablePath += '/';
m_StartDate = [[NSDate alloc] init];
m_startDate = [NSDate date];
m_dateFormatter = [[NSDateFormatter alloc] init];
[m_dateFormatter setDateFormat:@"EEE_MMM_dd_HH:mm:ss_yyyy"];
/// Hardcoding screen resolution depending on the device we are running.
m_visualScale = 1.0;
@ -68,10 +70,15 @@ IPhonePlatform::IPhonePlatform()
[pool release];
}
IPhonePlatform::~IPhonePlatform()
{
[m_dateFormatter release];
}
double IPhonePlatform::TimeInSec() const
{
NSDate * now = [[NSDate alloc] init];
double interval = [now timeIntervalSinceDate:m_StartDate];
double interval = [now timeIntervalSinceDate:m_startDate];
[now release];
return interval;
}
@ -212,6 +219,15 @@ string const IPhonePlatform::DeviceID() const
return m_deviceID;
}
string const IPhonePlatform::TimeString() const
{
NSDate * now = [NSDate date];
NSString * timeString = [m_dateFormatter stringFromDate:now];
string res = string([timeString UTF8String]);
[timeString release];
return res;
}
Platform & GetPlatform()
{
static IPhonePlatform platform;

View file

@ -18,7 +18,7 @@ public:
/// Time in seconds passed from application start
virtual double TimeInSec() const = 0;
virtual string TimeString() const = 0;
virtual string const TimeString() const = 0;
/// @return always the same writable dir for current user with slash at the end
virtual string WritableDir() const = 0;

View file

@ -415,7 +415,7 @@ public:
return 512 + 256;
}
string TimeString() const
string const TimeString() const
{
time_t rawtime;
time(&rawtime);