Fix #8350: clockconfig has to use the current offset from GMT.
* instead of re-applying the fixed offset that had been set when the Time preflet was used last, use the stored timezone name in clockconfig in order to determine the current GMT-offset for that timezone * clockconfig now requires liblocale.so * drop the offset field from the settings as it is no longer used, clockconfig was the only client * automatic whitespace cleanup
This commit is contained in:
parent
0437cdba8f
commit
d9dc0dda43
@ -84,7 +84,6 @@ StdBinCommands
|
||||
catattr.cpp
|
||||
checkfs.cpp
|
||||
clipboard.cpp
|
||||
clockconfig.cpp
|
||||
df.cpp
|
||||
diskimage.cpp
|
||||
dpms.cpp
|
||||
@ -131,6 +130,7 @@ StdBinCommands
|
||||
|
||||
# commands that need libbe.so and liblocale.so
|
||||
StdBinCommands
|
||||
clockconfig.cpp
|
||||
query.cpp
|
||||
: be $(HAIKU_LOCALE_LIBS) : $(haiku-utils_rsrc) ;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2004, Jérôme Duval, jerome.duval@free.fr.
|
||||
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
|
||||
* Copyright 2010, 2012, Oliver Tappe <zooey@hirschkaefer.de>
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <OS.h>
|
||||
#include <Path.h>
|
||||
#include <String.h>
|
||||
#include <TimeZone.h>
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
@ -63,21 +64,17 @@ setTimeZoneOffset(BPath path)
|
||||
fprintf(stderr, "%s: unable to parse Time settings file\n", program);
|
||||
return;
|
||||
}
|
||||
BString timeZoneName;
|
||||
if (settings.FindString("timezone", &timeZoneName) != B_OK) {
|
||||
BString timeZoneID;
|
||||
if (settings.FindString("timezone", &timeZoneID) != B_OK) {
|
||||
fprintf(stderr, "%s: no timezone found\n", program);
|
||||
return;
|
||||
}
|
||||
int32 timeZoneOffset;
|
||||
if (settings.FindInt32("offset", &timeZoneOffset) != B_OK) {
|
||||
fprintf(stderr, "%s: no timezone offset found\n", program);
|
||||
return;
|
||||
}
|
||||
int32 timeZoneOffset = BTimeZone(timeZoneID.String()).OffsetFromGMT();
|
||||
|
||||
_kern_set_timezone(timeZoneOffset, timeZoneName.String(),
|
||||
timeZoneName.Length());
|
||||
_kern_set_timezone(timeZoneOffset, timeZoneID.String(),
|
||||
timeZoneID.Length());
|
||||
printf("timezone is %s, offset is %ld seconds from GMT.\n",
|
||||
timeZoneName.String(), timeZoneOffset);
|
||||
timeZoneID.String(), timeZoneOffset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,7 +131,6 @@ static const char* kPriorityAttr = "ADDON:priority";
|
||||
|
||||
static const char* kLanguageField = "language";
|
||||
static const char* kTimezoneField = "timezone";
|
||||
static const char* kOffsetField = "offset";
|
||||
static const char* kTranslateFilesystemField = "filesys";
|
||||
|
||||
|
||||
@ -502,7 +501,7 @@ RosterData::_LoadLocaleSettings()
|
||||
fDefaultLocale.SetFormattingConventions(conventions);
|
||||
|
||||
_SetPreferredLanguages(&settings);
|
||||
|
||||
|
||||
bool preferred;
|
||||
if (settings.FindBool(kTranslateFilesystemField, &preferred) == B_OK)
|
||||
_SetFilesystemTranslationPreferred(preferred);
|
||||
@ -687,16 +686,7 @@ RosterData::_AddDefaultFormattingConventionsToMessage(BMessage* message) const
|
||||
status_t
|
||||
RosterData::_AddDefaultTimeZoneToMessage(BMessage* message) const
|
||||
{
|
||||
status_t status = message->AddString(kTimezoneField, fDefaultTimeZone.ID());
|
||||
|
||||
// add the offset, too, since that is used by clockconfig when setting
|
||||
// up timezone state during boot
|
||||
if (status == B_OK) {
|
||||
status = message->AddInt32(kOffsetField,
|
||||
fDefaultTimeZone.OffsetFromGMT());
|
||||
}
|
||||
|
||||
return status;
|
||||
return message->AddString(kTimezoneField, fDefaultTimeZone.ID());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user