2 * Copyright 2002-2011, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Andrew McCall <mccall@digitalparadise.co.uk>
7 * Mike Berg <mike@berg-net.us>
8 * Julun <host.haiku@gmx.de>
9 * Hamish Morrison <hamish@lavabit.com>
21 #include <LocaleRoster.h>
23 #include "NetworkTimeView.h"
24 #include "TimeMessages.h"
25 #include "TimeWindow.h"
28 #undef B_TRANSLATION_CONTEXT
29 #define B_TRANSLATION_CONTEXT "Time"
32 const char* kAppSignature
= "application/x-vnd.Haiku-Time";
35 TimeApplication::TimeApplication()
37 BApplication(kAppSignature
),
40 fWindow
= new TTimeWindow();
44 TimeApplication::~TimeApplication()
50 TimeApplication::ReadyToRun()
57 TimeApplication::AboutRequested()
59 BAlert
* alert
= new BAlert(B_TRANSLATE("about"),
61 "Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
62 "Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2012, Haiku."),
64 alert
->SetFlags(alert
->Flags() | B_CLOSE_ON_ESCAPE
);
70 TimeApplication::MessageReceived(BMessage
* message
)
72 switch (message
->what
) {
75 case B_LOCALE_CHANGED
:
76 fWindow
->PostMessage(message
);
80 BApplication::MessageReceived(message
);
87 main(int argc
, char** argv
)
90 if (strcmp(argv
[1], "--update") != 0)
94 if (!settings
.GetSynchronizeAtBoot())
97 const char* errorString
= NULL
;
99 if (update_time(settings
, &errorString
, &errorCode
) == B_OK
) {
100 printf("Synchronization successful\r\n");
101 } else if (errorCode
!= 0) {
102 printf("The following error occured "
103 "while synchronizing:\r\n%s: %s\r\n",
104 errorString
, strerror(errorCode
));
106 printf("The following error occured while synchronizing:\r\n%s\r\n",
110 setlocale(LC_ALL
, "");