Apple: always use the system time zone instead of the default time zone
This corrects an issue converting dates and times to strings which would use the "default" time zone (CFTimeZoneCopyDefault) in contrast to the rest of Qt which uses the system time zone in such contexts. [ChangeLog][QtCore][QLocale] Qt functions now always use the system time zone on Apple platforms, the same that low-level C APIs like localtime() does. Previously, converting dates and times to strings would use the "default" time zone (which is almost always the same as the "system" time zone but could be changed with the Apple API). Change-Id: I2942c3c1c8aa01a0130f1b7280371a72bdb01b1c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c1cece8e54
commit
bd78f57463
@ -123,8 +123,7 @@ static QString macDayName(int day, bool short_format)
|
||||
|
||||
static QString macDateToString(const QDate &date, bool short_format)
|
||||
{
|
||||
const QTimeZone tz = QTimeZone::fromCFTimeZone(QCFType<CFTimeZoneRef>(CFTimeZoneCopyDefault()));
|
||||
QCFType<CFDateRef> myDate = QDateTime(date, QTime(), tz).toCFDate();
|
||||
QCFType<CFDateRef> myDate = QDateTime(date, QTime()).toCFDate();
|
||||
QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent();
|
||||
CFDateFormatterStyle style = short_format ? kCFDateFormatterShortStyle : kCFDateFormatterLongStyle;
|
||||
QCFType<CFDateFormatterRef> myFormatter
|
||||
@ -136,8 +135,7 @@ static QString macDateToString(const QDate &date, bool short_format)
|
||||
|
||||
static QString macTimeToString(const QTime &time, bool short_format)
|
||||
{
|
||||
const QTimeZone tz = QTimeZone::fromCFTimeZone(QCFType<CFTimeZoneRef>(CFTimeZoneCopyDefault()));
|
||||
QCFType<CFDateRef> myDate = QDateTime(QDate::currentDate(), time, tz).toCFDate();
|
||||
QCFType<CFDateRef> myDate = QDateTime(QDate::currentDate(), time).toCFDate();
|
||||
QCFType<CFLocaleRef> mylocale = CFLocaleCopyCurrent();
|
||||
CFDateFormatterStyle style = short_format ? kCFDateFormatterShortStyle : kCFDateFormatterLongStyle;
|
||||
QCFType<CFDateFormatterRef> myFormatter = CFDateFormatterCreate(kCFAllocatorDefault,
|
||||
|
Loading…
Reference in New Issue
Block a user