0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++ builder > 時計変更時の処理 / SetLocalTime()実行後

Last updated at Posted at 2015-11-25
動作確認
C++ Builder XE4
Unit1.cpp
bool __fastcall TFormMain::AdjustLocalTime(String datetime)
{
	TSystemTime systime;
	TDateTime dt;

	dt = VarToDateTime(datetime);
	DateTimeToSystemTime(dt, systime);
	if (SetLocalTime(&systime) == false) {
//		RaiseLastOSError();
		return false;
	}

	if (m_thr_main != NULL) {
		m_thr_main->NotifyClockAdjusted();
	}
	return true;
}

m_thr_main : はTThread *型。

時刻調整が入ったら、スレッド処理に連絡を入れて、その先のスレッドで必要な処理を実行するという感じ。

VarToDateTime()を使っているのは、ENU対応。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?