1a10cf76eSAxel Dörfler /* 24ae5a452SAdrien Destugues * Copyright 2004-2010, Haiku, Inc. All Rights Reserved. 353d9356eSStephan Aßmus * Distributed under the terms of the MIT License. 453d9356eSStephan Aßmus * 553d9356eSStephan Aßmus * Authors: 600826781SKarsten Heimrich * Mike Berg <mike@berg-net.us> 753d9356eSStephan Aßmus * Julun <host.haiku@gmx.de> 8310930fdSStephan Aßmus * Philippe Saint-Pierre <stpere@gmail.com> 94ae5a452SAdrien Destugues * Adrien Destugues <pulkomandy@pulkomandy.ath.cx> 10*99d2aa98SOliver Tappe * Oliver Tappe <zooey@hirschkaefer.de> 1153d9356eSStephan Aßmus */ 1242b3a11fSStephan Aßmus 1353d9356eSStephan Aßmus /* 1453d9356eSStephan Aßmus Exceptions: 1553d9356eSStephan Aßmus doesn't calc "Time in" time. 16a10cf76eSAxel Dörfler */ 17a10cf76eSAxel Dörfler 1842b3a11fSStephan Aßmus #include "ZoneView.h" 19a10cf76eSAxel Dörfler 20317bd7ddSAxel Dörfler #include <stdio.h> 21317bd7ddSAxel Dörfler #include <stdlib.h> 2242b3a11fSStephan Aßmus 2342b3a11fSStephan Aßmus #include <Button.h> 24*99d2aa98SOliver Tappe #include <Collator.h> 25a10cf76eSAxel Dörfler #include <Directory.h> 26a10cf76eSAxel Dörfler #include <Entry.h> 27a10cf76eSAxel Dörfler #include <FindDirectory.h> 2842b3a11fSStephan Aßmus #include <ListItem.h> 294ae5a452SAdrien Destugues #include <Locale.h> 304ae5a452SAdrien Destugues #include <LocaleRoster.h> 314ae5a452SAdrien Destugues #include <OutlineListView.h> 32a10cf76eSAxel Dörfler #include <ScrollView.h> 33a10cf76eSAxel Dörfler #include <StorageDefs.h> 34a10cf76eSAxel Dörfler #include <String.h> 354ae5a452SAdrien Destugues #include <TimeZone.h> 36a10cf76eSAxel Dörfler #include <View.h> 37310930fdSStephan Aßmus #include <Window.h> 38a10cf76eSAxel Dörfler 39317bd7ddSAxel Dörfler #include <syscalls.h> 40a10cf76eSAxel Dörfler 41317bd7ddSAxel Dörfler #include "TimeMessages.h" 424ae5a452SAdrien Destugues #include "TimeZoneListItem.h" 43317bd7ddSAxel Dörfler #include "TZDisplay.h" 44317bd7ddSAxel Dörfler #include "TimeWindow.h" 45a10cf76eSAxel Dörfler 46a10cf76eSAxel Dörfler 47*99d2aa98SOliver Tappe static BCollator sCollator; 48*99d2aa98SOliver Tappe // used to sort the timezone list 49*99d2aa98SOliver Tappe 50*99d2aa98SOliver Tappe 5185b69a94SKarsten Heimrich TimeZoneView::TimeZoneView(BRect frame) 52*99d2aa98SOliver Tappe : 53*99d2aa98SOliver Tappe BView(frame, "timeZoneView", B_FOLLOW_NONE, B_WILL_DRAW | B_NAVIGABLE_JUMP), 54*99d2aa98SOliver Tappe fCurrentZone(NULL), 55*99d2aa98SOliver Tappe fOldZone(NULL), 56*99d2aa98SOliver Tappe fInitialized(false) 57a10cf76eSAxel Dörfler { 586d6408d6SOliver Tappe _InitView(); 59a10cf76eSAxel Dörfler } 60a10cf76eSAxel Dörfler 61a10cf76eSAxel Dörfler 62310930fdSStephan Aßmus bool 63310930fdSStephan Aßmus TimeZoneView::CheckCanRevert() 64310930fdSStephan Aßmus { 65310930fdSStephan Aßmus return fCurrentZone != fOldZone; 66310930fdSStephan Aßmus } 67310930fdSStephan Aßmus 68310930fdSStephan Aßmus 69310930fdSStephan Aßmus void 70310930fdSStephan Aßmus TimeZoneView::_Revert() 71310930fdSStephan Aßmus { 72310930fdSStephan Aßmus fCurrentZone = fOldZone; 73317bd7ddSAxel Dörfler int32 czone = 0; 74310930fdSStephan Aßmus 754ae5a452SAdrien Destugues if (fCurrentZone != NULL) { 764ae5a452SAdrien Destugues czone = fCityList->IndexOf(fCurrentZone); 77310930fdSStephan Aßmus fCityList->Select(czone); 78310930fdSStephan Aßmus } 794ae5a452SAdrien Destugues // TODO : else, select ??! 804ae5a452SAdrien Destugues 814ae5a452SAdrien Destugues fCityList->ScrollToSelection(); 824ae5a452SAdrien Destugues fCurrent->SetText(((TimeZoneListItem*)fCityList->ItemAt(czone))->Text()); 836d6408d6SOliver Tappe _SetPreview(); 846d6408d6SOliver Tappe _SetTimeZone(); 85310930fdSStephan Aßmus } 86310930fdSStephan Aßmus 87310930fdSStephan Aßmus 8885b69a94SKarsten Heimrich TimeZoneView::~TimeZoneView() 89a10cf76eSAxel Dörfler { 904ae5a452SAdrien Destugues delete fCurrentZone; 914ae5a452SAdrien Destugues delete fOldZone; 92a10cf76eSAxel Dörfler } 93a10cf76eSAxel Dörfler 94a10cf76eSAxel Dörfler 95a10cf76eSAxel Dörfler void 9685b69a94SKarsten Heimrich TimeZoneView::AttachedToWindow() 97a10cf76eSAxel Dörfler { 98a10cf76eSAxel Dörfler if (Parent()) 99a10cf76eSAxel Dörfler SetViewColor(Parent()->ViewColor()); 100a10cf76eSAxel Dörfler 10185b69a94SKarsten Heimrich if (!fInitialized) { 10285b69a94SKarsten Heimrich fInitialized = true; 10385b69a94SKarsten Heimrich 10442b3a11fSStephan Aßmus fSetZone->SetTarget(this); 10542b3a11fSStephan Aßmus fCityList->SetTarget(this); 10642b3a11fSStephan Aßmus 107a10cf76eSAxel Dörfler // update displays 1084ae5a452SAdrien Destugues int32 czone = 0; 1094ae5a452SAdrien Destugues if (fCurrentZone != NULL) { 1104ae5a452SAdrien Destugues czone = fCityList->IndexOf(fCurrentZone); 111310930fdSStephan Aßmus } else { 1124ae5a452SAdrien Destugues // TODO : else, select ??! 1134ae5a452SAdrien Destugues fCurrentZone = (TimeZoneListItem*)fCityList->ItemAt(0); 1144ae5a452SAdrien Destugues } 1154ae5a452SAdrien Destugues 116310930fdSStephan Aßmus fCityList->Select(czone); 1174ae5a452SAdrien Destugues 1184ae5a452SAdrien Destugues fCityList->ScrollToSelection(); 1194ae5a452SAdrien Destugues fCurrent->SetText(fCurrentZone->Text()); 120a10cf76eSAxel Dörfler } 12142b3a11fSStephan Aßmus fCityList->ScrollToSelection(); 122a10cf76eSAxel Dörfler } 123a10cf76eSAxel Dörfler 124a10cf76eSAxel Dörfler 125a10cf76eSAxel Dörfler void 12685b69a94SKarsten Heimrich TimeZoneView::MessageReceived(BMessage* message) 127a10cf76eSAxel Dörfler { 128a10cf76eSAxel Dörfler switch (message->what) { 129a10cf76eSAxel Dörfler case B_OBSERVER_NOTICE_CHANGE: 130317bd7ddSAxel Dörfler { 131317bd7ddSAxel Dörfler int32 change; 132a10cf76eSAxel Dörfler message->FindInt32(B_OBSERVE_WHAT_CHANGE, &change); 133a10cf76eSAxel Dörfler switch(change) { 134a10cf76eSAxel Dörfler case H_TM_CHANGED: 1356d6408d6SOliver Tappe _UpdateDateTime(message); 136a10cf76eSAxel Dörfler break; 137a10cf76eSAxel Dörfler 138a10cf76eSAxel Dörfler default: 139a10cf76eSAxel Dörfler BView::MessageReceived(message); 140a10cf76eSAxel Dörfler break; 141a10cf76eSAxel Dörfler } 142a10cf76eSAxel Dörfler break; 143317bd7ddSAxel Dörfler } 144317bd7ddSAxel Dörfler 145a10cf76eSAxel Dörfler case H_SET_TIME_ZONE: 146310930fdSStephan Aßmus { 1476d6408d6SOliver Tappe _SetTimeZone(); 148310930fdSStephan Aßmus ((TTimeWindow*)Window())->SetRevertStatus(); 149310930fdSStephan Aßmus break; 150310930fdSStephan Aßmus } 151310930fdSStephan Aßmus 152310930fdSStephan Aßmus case kMsgRevert: 153310930fdSStephan Aßmus _Revert(); 154a10cf76eSAxel Dörfler break; 155a10cf76eSAxel Dörfler 156a10cf76eSAxel Dörfler case H_CITY_CHANGED: 1576d6408d6SOliver Tappe _SetPreview(); 158a10cf76eSAxel Dörfler break; 159a10cf76eSAxel Dörfler 160a10cf76eSAxel Dörfler default: 161a10cf76eSAxel Dörfler BView::MessageReceived(message); 162a10cf76eSAxel Dörfler break; 163a10cf76eSAxel Dörfler } 164a10cf76eSAxel Dörfler } 165a10cf76eSAxel Dörfler 166a10cf76eSAxel Dörfler 167a10cf76eSAxel Dörfler void 1686d6408d6SOliver Tappe TimeZoneView::_UpdateDateTime(BMessage* message) 169a10cf76eSAxel Dörfler { 17042b3a11fSStephan Aßmus int32 hour; 17142b3a11fSStephan Aßmus int32 minute; 172a10cf76eSAxel Dörfler 17342b3a11fSStephan Aßmus // only need hour and minute 174a10cf76eSAxel Dörfler if (message->FindInt32("hour", &hour) == B_OK 175a10cf76eSAxel Dörfler && message->FindInt32("minute", &minute) == B_OK) { 17642b3a11fSStephan Aßmus if (fHour != hour || fMinute != minute) { 17742b3a11fSStephan Aßmus fHour = hour; 17842b3a11fSStephan Aßmus fMinute = minute; 179fd7c0c2eSStephan Aßmus fCurrent->SetTime(hour, minute); 180a10cf76eSAxel Dörfler 181a10cf76eSAxel Dörfler // do calc to get other zone time 18242b3a11fSStephan Aßmus if (fCityList->CurrentSelection() > -1) 1836d6408d6SOliver Tappe _SetPreview(); 184a10cf76eSAxel Dörfler } 185a10cf76eSAxel Dörfler } 186a10cf76eSAxel Dörfler } 187a10cf76eSAxel Dörfler 188a10cf76eSAxel Dörfler 189a10cf76eSAxel Dörfler void 1906d6408d6SOliver Tappe TimeZoneView::_InitView() 191a10cf76eSAxel Dörfler { 19242b3a11fSStephan Aßmus // left side 19342b3a11fSStephan Aßmus BRect frameLeft(Bounds()); 19485b69a94SKarsten Heimrich frameLeft.right = frameLeft.Width() / 2.0; 19542b3a11fSStephan Aßmus frameLeft.InsetBy(10.0f, 10.0f); 196a10cf76eSAxel Dörfler 197a10cf76eSAxel Dörfler // City Listing 1984ae5a452SAdrien Destugues fCityList = new BOutlineListView(frameLeft, "cityList", 1994ae5a452SAdrien Destugues B_SINGLE_SELECTION_LIST); 20042b3a11fSStephan Aßmus fCityList->SetSelectionMessage(new BMessage(H_CITY_CHANGED)); 20142b3a11fSStephan Aßmus fCityList->SetInvocationMessage(new BMessage(H_SET_TIME_ZONE)); 202a10cf76eSAxel Dörfler 2036d6408d6SOliver Tappe _BuildRegionMenu(); 2044ae5a452SAdrien Destugues 20585b69a94SKarsten Heimrich BScrollView* scrollList = new BScrollView("scrollList", fCityList, 20642b3a11fSStephan Aßmus B_FOLLOW_ALL, 0, false, true); 207a10cf76eSAxel Dörfler AddChild(scrollList); 208a10cf76eSAxel Dörfler 20942b3a11fSStephan Aßmus // right side 21042b3a11fSStephan Aßmus BRect frameRight(Bounds()); 21185b69a94SKarsten Heimrich frameRight.left = frameRight.Width() / 2.0; 21242b3a11fSStephan Aßmus frameRight.InsetBy(10.0f, 10.0f); 21342b3a11fSStephan Aßmus frameRight.top = frameLeft.top; 214a10cf76eSAxel Dörfler 215a10cf76eSAxel Dörfler // Time Displays 21685b69a94SKarsten Heimrich fCurrent = new TTZDisplay(frameRight, "currentTime", "Current time:"); 21742b3a11fSStephan Aßmus AddChild(fCurrent); 21842b3a11fSStephan Aßmus fCurrent->ResizeToPreferred(); 219a10cf76eSAxel Dörfler 22085b69a94SKarsten Heimrich frameRight.top = fCurrent->Frame().bottom + 10.0; 22185b69a94SKarsten Heimrich fPreview = new TTZDisplay(frameRight, "previewTime", "Preview time:"); 22242b3a11fSStephan Aßmus AddChild(fPreview); 22342b3a11fSStephan Aßmus fPreview->ResizeToPreferred(); 224a10cf76eSAxel Dörfler 225a10cf76eSAxel Dörfler // set button 2269c1a9b92SAdrien Destugues fSetZone = new BButton(frameRight, "setTimeZone", "Set time zone", 22785b69a94SKarsten Heimrich new BMessage(H_SET_TIME_ZONE)); 22842b3a11fSStephan Aßmus AddChild(fSetZone); 22942b3a11fSStephan Aßmus fSetZone->SetEnabled(false); 23042b3a11fSStephan Aßmus fSetZone->ResizeToPreferred(); 231a10cf76eSAxel Dörfler 23242b3a11fSStephan Aßmus fSetZone->MoveTo(frameRight.right - fSetZone->Bounds().Width(), 23342b3a11fSStephan Aßmus scrollList->Frame().bottom - fSetZone->Bounds().Height()); 234a10cf76eSAxel Dörfler } 235a10cf76eSAxel Dörfler 236a10cf76eSAxel Dörfler 237a10cf76eSAxel Dörfler void 2386d6408d6SOliver Tappe TimeZoneView::_BuildRegionMenu() 239a10cf76eSAxel Dörfler { 240*99d2aa98SOliver Tappe BTimeZone* defaultTimeZone = NULL; 241*99d2aa98SOliver Tappe be_locale_roster->GetDefaultTimeZone(&defaultTimeZone); 242*99d2aa98SOliver Tappe 243*99d2aa98SOliver Tappe // Get a list of countries and, for each country, get all the timezones and 244*99d2aa98SOliver Tappe // AddUnder() them (only if there are multiple ones). 245*99d2aa98SOliver Tappe // Finally expand the current country and highlight the active TZ. 246a10cf76eSAxel Dörfler 2474ae5a452SAdrien Destugues BMessage countryList; 2484ae5a452SAdrien Destugues be_locale_roster->GetAvailableCountries(&countryList); 249a10cf76eSAxel Dörfler 2504ae5a452SAdrien Destugues BString countryCode; 2514ae5a452SAdrien Destugues for (int i = 0; countryList.FindString("countries", i, &countryCode) 2524ae5a452SAdrien Destugues == B_OK; i++) { 2534ae5a452SAdrien Destugues BCountry country("", countryCode); 2544ae5a452SAdrien Destugues BString fullName; 2554ae5a452SAdrien Destugues country.Name(fullName); 256a10cf76eSAxel Dörfler 2574ae5a452SAdrien Destugues // Now list the timezones for this country 2584ae5a452SAdrien Destugues BList tzList; 259a10cf76eSAxel Dörfler 260*99d2aa98SOliver Tappe BTimeZone* timeZone; 2614ae5a452SAdrien Destugues TimeZoneListItem* countryItem; 2624ae5a452SAdrien Destugues switch (country.GetTimeZones(tzList)) 263a10cf76eSAxel Dörfler { 2644ae5a452SAdrien Destugues case 0: 2654ae5a452SAdrien Destugues // No TZ info for this country. Sorry guys! 2664ae5a452SAdrien Destugues break; 2674ae5a452SAdrien Destugues case 1: 2684ae5a452SAdrien Destugues // Only one Timezone, no need to add it to the list 269*99d2aa98SOliver Tappe timeZone = (BTimeZone*)tzList.ItemAt(0); 270*99d2aa98SOliver Tappe countryItem 271*99d2aa98SOliver Tappe = new TimeZoneListItem(fullName, &country, timeZone); 2724ae5a452SAdrien Destugues fCityList->AddItem(countryItem); 273*99d2aa98SOliver Tappe if (timeZone->Code() == defaultTimeZone->Code()) 274*99d2aa98SOliver Tappe fCurrentZone = countryItem; 2754ae5a452SAdrien Destugues break; 2764ae5a452SAdrien Destugues default: 2774ae5a452SAdrien Destugues countryItem = new TimeZoneListItem(fullName, &country, NULL); 278*99d2aa98SOliver Tappe countryItem->SetExpanded(false); 2794ae5a452SAdrien Destugues fCityList->AddItem(countryItem); 2804ae5a452SAdrien Destugues 2816d6408d6SOliver Tappe for (int j = 0; 2826d6408d6SOliver Tappe (timeZone = (BTimeZone*)tzList.ItemAt(j)) != NULL; 2836d6408d6SOliver Tappe j++) { 284*99d2aa98SOliver Tappe TimeZoneListItem* tzItem = new TimeZoneListItem( 285*99d2aa98SOliver Tappe timeZone->Name(), NULL, timeZone); 2864ae5a452SAdrien Destugues fCityList->AddUnder(tzItem, countryItem); 287*99d2aa98SOliver Tappe if (timeZone->Code() == defaultTimeZone->Code()) 288*99d2aa98SOliver Tappe { 289*99d2aa98SOliver Tappe fCurrentZone = tzItem; 290*99d2aa98SOliver Tappe countryItem->SetExpanded(true); 291*99d2aa98SOliver Tappe } 29242b3a11fSStephan Aßmus } 2934ae5a452SAdrien Destugues break; 294a10cf76eSAxel Dörfler } 295a10cf76eSAxel Dörfler } 296317bd7ddSAxel Dörfler 297*99d2aa98SOliver Tappe fOldZone = fCurrentZone; 298*99d2aa98SOliver Tappe 299*99d2aa98SOliver Tappe delete defaultTimeZone; 300*99d2aa98SOliver Tappe 301*99d2aa98SOliver Tappe struct ListSorter { 302*99d2aa98SOliver Tappe static int compare(const BListItem* first, const BListItem* second) 303*99d2aa98SOliver Tappe { 304*99d2aa98SOliver Tappe return sCollator.Compare(((BStringItem*)first)->Text(), 305*99d2aa98SOliver Tappe ((BStringItem*)second)->Text()); 306*99d2aa98SOliver Tappe } 307*99d2aa98SOliver Tappe }; 308*99d2aa98SOliver Tappe fCityList->SortItemsUnder(NULL, true, ListSorter::compare); 309*99d2aa98SOliver Tappe 310a10cf76eSAxel Dörfler } 311a10cf76eSAxel Dörfler 312a10cf76eSAxel Dörfler 313a10cf76eSAxel Dörfler void 3146d6408d6SOliver Tappe TimeZoneView::_SetPreview() 315a10cf76eSAxel Dörfler { 31642b3a11fSStephan Aßmus int32 selection = fCityList->CurrentSelection(); 317a10cf76eSAxel Dörfler if (selection >= 0) { 318*99d2aa98SOliver Tappe TimeZoneListItem* item 319*99d2aa98SOliver Tappe = (TimeZoneListItem*)fCityList->ItemAt(selection); 320fd7c0c2eSStephan Aßmus 321fd7c0c2eSStephan Aßmus // calc preview time 322*99d2aa98SOliver Tappe time_t current = time(NULL) + item->OffsetFromGMT(); 323d3bde5deSAxel Dörfler struct tm localTime; 324*99d2aa98SOliver Tappe gmtime_r(¤t, &localTime); 325fd7c0c2eSStephan Aßmus 326fd7c0c2eSStephan Aßmus // update prview 327fd7c0c2eSStephan Aßmus fPreview->SetText(item->Text()); 328d3bde5deSAxel Dörfler fPreview->SetTime(localTime.tm_hour, localTime.tm_min); 329fd7c0c2eSStephan Aßmus 330fd7c0c2eSStephan Aßmus fSetZone->SetEnabled((strcmp(fCurrent->Text(), item->Text()) != 0)); 331a10cf76eSAxel Dörfler } 332a10cf76eSAxel Dörfler } 333a10cf76eSAxel Dörfler 334a10cf76eSAxel Dörfler 335a10cf76eSAxel Dörfler void 3366d6408d6SOliver Tappe TimeZoneView::_SetCurrent(const char* text) 337a10cf76eSAxel Dörfler { 338*99d2aa98SOliver Tappe _SetTimeZone(fCurrentZone->Code().String()); 339fd7c0c2eSStephan Aßmus 340d3bde5deSAxel Dörfler time_t current = time(NULL); 341d3bde5deSAxel Dörfler struct tm localTime; 342d3bde5deSAxel Dörfler localtime_r(¤t, &localTime); 343a10cf76eSAxel Dörfler 34442b3a11fSStephan Aßmus fCurrent->SetText(text); 345d3bde5deSAxel Dörfler fCurrent->SetTime(localTime.tm_hour, localTime.tm_min); 346a10cf76eSAxel Dörfler } 347a10cf76eSAxel Dörfler 348a10cf76eSAxel Dörfler 349a10cf76eSAxel Dörfler void 3506d6408d6SOliver Tappe TimeZoneView::_SetTimeZone() 351a10cf76eSAxel Dörfler { 35242b3a11fSStephan Aßmus /* set time based on supplied timezone. How to do this? 3534ae5a452SAdrien Destugues 1) replace symlink "timezone" in B_USER_SETTINGS_DIR with a link to the 3544ae5a452SAdrien Destugues new timezone 355a10cf76eSAxel Dörfler 2) set TZ environment var 356a10cf76eSAxel Dörfler 3) call settz() 357a10cf76eSAxel Dörfler 4) call set_timezone from OS.h passing path to timezone file 358a10cf76eSAxel Dörfler */ 359a10cf76eSAxel Dörfler 36042b3a11fSStephan Aßmus int32 selection = fCityList->CurrentSelection(); 361a10cf76eSAxel Dörfler if (selection < 0) 362a10cf76eSAxel Dörfler return; 363a10cf76eSAxel Dörfler 364*99d2aa98SOliver Tappe const BString& code 365*99d2aa98SOliver Tappe = ((TimeZoneListItem*)fCityList->ItemAt(selection))->Code(); 366*99d2aa98SOliver Tappe _SetTimeZone(code.String()); 367a10cf76eSAxel Dörfler 368a10cf76eSAxel Dörfler // update display 369d3bde5deSAxel Dörfler time_t current = time(NULL); 370d3bde5deSAxel Dörfler struct tm localTime; 371d3bde5deSAxel Dörfler localtime_r(¤t, &localTime); 372a10cf76eSAxel Dörfler 373*99d2aa98SOliver Tappe set_timezone(code.String()); 374a10cf76eSAxel Dörfler // disable button 37542b3a11fSStephan Aßmus fSetZone->SetEnabled(false); 376a10cf76eSAxel Dörfler 377d3bde5deSAxel Dörfler time_t newTime = mktime(&localTime); 378d3bde5deSAxel Dörfler localtime_r(&newTime, &localTime); 379d3bde5deSAxel Dörfler stime(&newTime); 380a10cf76eSAxel Dörfler 381d3bde5deSAxel Dörfler fHour = localTime.tm_hour; 382d3bde5deSAxel Dörfler fMinute = localTime.tm_min; 3834ae5a452SAdrien Destugues fCurrentZone = (TimeZoneListItem*)(fCityList->ItemAt(selection)); 3846d6408d6SOliver Tappe _SetCurrent(((TimeZoneListItem*)fCityList->ItemAt(selection))->Text()); 385a10cf76eSAxel Dörfler } 386a10cf76eSAxel Dörfler 387a10cf76eSAxel Dörfler 388a10cf76eSAxel Dörfler void 3896d6408d6SOliver Tappe TimeZoneView::_SetTimeZone(const char* zone) 390a10cf76eSAxel Dörfler { 39142b3a11fSStephan Aßmus putenv(BString("TZ=").Append(zone).String()); 392a10cf76eSAxel Dörfler tzset(); 3931855b44cSAdrien Destugues 3941855b44cSAdrien Destugues be_locale_roster->SetDefaultTimeZone(zone); 395a10cf76eSAxel Dörfler } 396a10cf76eSAxel Dörfler 397