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>
22 #include "NetworkTimeView.h"
23 #include "TimeMessages.h"
24 #include "TimeWindow.h"
27 #undef B_TRANSLATION_CONTEXT
28 #define B_TRANSLATION_CONTEXT "Time"
31 const char* kAppSignature
= "application/x-vnd.Haiku-Time";
34 TimeApplication::TimeApplication()
36 BApplication(kAppSignature
),
39 fWindow
= new TTimeWindow();
43 TimeApplication::~TimeApplication()
49 TimeApplication::ReadyToRun()
56 TimeApplication::AboutRequested()
58 BAlert
* alert
= new BAlert(B_TRANSLATE("about"),
60 "Time & Date, written by:\n\n\tAndrew Edward McCall\n\tMike Berg\n\t"
61 "Julun\n\tPhilippe Saint-Pierre\n\nCopyright 2004-2012, Haiku."),
63 alert
->SetFlags(alert
->Flags() | B_CLOSE_ON_ESCAPE
);
69 TimeApplication::MessageReceived(BMessage
* message
)
71 switch (message
->what
) {
74 fWindow
->PostMessage(message
);
78 BApplication::MessageReceived(message
);
85 main(int argc
, char** argv
)
88 if (strcmp(argv
[1], "--update") != 0)
92 if (!settings
.GetSynchronizeAtBoot())
95 const char* errorString
= NULL
;
97 if (update_time(settings
, &errorString
, &errorCode
) == B_OK
) {
98 printf("Synchronization successful\r\n");
99 } else if (errorCode
!= 0) {
100 printf("The following error occured "
101 "while synchronizing:\r\n%s: %s\r\n",
102 errorString
, strerror(errorCode
));
104 printf("The following error occured while synchronizing:\r\n%s\r\n",
108 setlocale(LC_ALL
, "");