STDMETHODIMP TimeZoneCheckCallback::Func() { SetTimeZone(); HXTimeval tNow = m_pProc->pc->scheduler->GetCurrentSchedulerTime(); // Compute time of next on-the-hour by rounding up HXTimeval tNext = tNow; tNext.tv_sec = ((tNext.tv_sec+(60*60)-1)/(60*60))*(60*60); tNext.tv_usec = 0; m_pProc->pc->scheduler->AbsoluteEnter(this, tNext); return HXR_OK; }
//TLogListDlg *LogListDlg; //--------------------------------------------------------------------- __fastcall TLogListDlg::TLogListDlg(TComponent* AOwner) : TForm(AOwner) { FormStyle = ((TForm *)AOwner)->FormStyle; Font->Name = ((TForm *)AOwner)->Font->Name; Font->Charset = ((TForm *)AOwner)->Font->Charset; if( sys.m_MsgEng ){ Grid->Font->Name = ((TForm *)AOwner)->Font->Name; Grid->Font->Charset = ((TForm *)AOwner)->Font->Charset; KFile->Caption = "File(&F)"; KEdit->Caption = "Edit(&E)"; KFind->Caption = "Find(&S)"; KOpt->Caption = "Option(&O)"; KOpen->Caption = "Open LogData File(&O)..."; KFlush->Caption = "Save data now(&M)"; KReIndex->Caption = "Make Index"; KMTextRead->Caption = "Load MMLOG TextFile(&R)..."; KMTextWrite->Caption = "Save selected range to MMLOG TextFile(&W)..."; KImport->Caption = "Import"; KImportLog200->Caption = "Log200 File..."; KImportHamlog->Caption = "Hamlog File..."; KImportADIF->Caption = "ADIF File..."; KExport->Caption = "Export selected range"; KExportADIF->Caption = "ADIF File..."; KExportLog200->Caption = "Log200 File..."; KExportHamlog->Caption = "Hamlog File..."; KExportCabrillo->Caption = "Cabrillo file..."; KExit->Caption = "Return to MMVARI(&X)"; KDelCur->Caption = "Cut"; KInsCur->Caption = "Insert"; KSelAll->Caption = "Select All"; KDelSel->Caption = "Delete selected range"; KSortDate->Caption = "Sort(Date/Time)"; KTop->Caption = "Move Top"; KBottom->Caption = "Move Last"; KFindTop->Caption = "Search forward..."; KFindBottom->Caption = "Search backward..."; KFindConT->Caption = "Search forward again"; KFindConB->Caption = "Search backward again"; KLogOpt->Caption = "Setup Logging..."; } int CX = ::GetSystemMetrics(SM_CXFULLSCREEN); int CY = ::GetSystemMetrics(SM_CYFULLSCREEN); if( (CX < Width)||(CY < Height) ){ Top = 0; Left = 0; Width = CX; Height = CY; } m_DateWidth = Grid->ColWidths[0]; FormCenter(this, CX, CY); if( Owner != NULL ){ WindowState = ((TForm *)Owner)->WindowState; } SetTimeZone(); KExportCabrillo->Visible = FALSE; // Delete this function by JE3HHT on Sep.2010 }
/* * Application entry. */ int main(void) { uint32_t baud = 115200; int cmd; /* Use UART device for stdin and stdout. */ NutRegisterDevice(&DEV_CONSOLE, 0, 0); freopen(DEV_CONSOLE.dev_name, "w", stdout); freopen(DEV_CONSOLE.dev_name, "r", stdin); _ioctl(_fileno(stdout), UART_SETSPEED, &baud); printf("\n\nCalendar Time %s running on Nut/OS %s\n" , version, NutVersionString()); #ifdef USE_LINE_EDITOR /* Open line editor, if configured. */ printf("Opening line editor..."); edline = EdLineOpen(EDIT_MODE_ECHO); if (edline) { puts("OK"); } else { puts("failed"); } #else puts("Note: Enable local echo!"); #endif #if USE_TIME_ZONE _timezone = USE_TIME_ZONE; #endif #ifdef RTC_CHIP /* Register and query hardware RTC, if available. */ printf("Registering RTC hardware..."); if (NutRegisterRtc(&RTC_CHIP)) { puts("failed"); } else { uint32_t rtc_stat; NutRtcGetStatus(&rtc_stat); if (rtc_stat & RTC_STATUS_PF) { #if defined(USE_BUILD_TIME) puts("power failure, Setting Time from Build date"); /* Initially use the compile date and time. */ time_t now = RfcTimeParse("Unk, " __DATE__ " " __TIME__); stime(&now); puts("Built " __DATE__ " " __TIME__); #else puts("power failure"); #endif } else { puts("OK"); } } #elif USE_BUILD_TIME { /* Initially use the compile date and time. */ time_t now = RfcTimeParse("Unk, " __DATE__ " " __TIME__); stime(&now); puts("Built " __DATE__ " " __TIME__); } #endif for (;;) { /* Print command menu. */ puts("\n 0 - Display seconds counter"); puts(" 1 - Display universal time"); puts(" 2 - Display local time"); puts(" 3 - Display system uptime"); puts(" C - Calculate weekday"); puts(" S - Set local time"); puts(" Y - Toggle DST calculation"); puts(" Z - Set timezone"); printf("What is thy bidding, my master? "); /* Flush input buffer. */ while (kbhit()) { cmd = getchar(); } /* Get the next command. */ cmd = getchar(); putchar('\n'); /* Process the command. */ switch (cmd) { case '0': DisplaySeconds(); break; case '1': DisplayZuluTime(); break; case '2': DisplayLocalTime(); break; case '3': DisplayUpTime(); break; case 'C': case 'c': CalcWeekDay(); break; case 'S': case 's': SetLocalTime(); break; case 'Y': case 'y': /* Nut/OS uses a global variable to enable/disable DST. Toggle the current status and display the result. */ _daylight = _daylight == 0; printf("DST calculation %sabled\n", _daylight ? "en" : "dis"); break; case 'Z': case 'z': SetTimeZone(); break; } } return 0; }
void DateTime::SetTimeZoneToUTC() { SetTimeZone("PST0"); }