void PowerdScheduler::HandleSystemTimeResponse(MojServiceMessage *msg,
	const MojObject& response, MojErr err)
{
	LOG_AM_TRACE("Entering function %s", __FUNCTION__);
	LOG_AM_DEBUG("System Time response %s",
		MojoObjectJson(response).c_str());

	if (err != MojErrNone) {
		if (MojoCall::IsPermanentFailure(msg, response, err)) {
			LOG_AM_WARNING(MSGID_SYS_TIME_RSP_FAIL,0,
				"System Time subscription experienced an uncorrectable failure: %s",
				MojoObjectJson(response).c_str());
			m_systemTimeCall.reset();
		} else {
			LOG_AM_WARNING(MSGID_GET_SYSTIME_RETRY,0,
				"System Time subscription failed, retrying: %s", MojoObjectJson(response).c_str());
			MonitorSystemTime();
		}
		return;
	}

	MojInt64 localOffset;

	bool found = response.get(_T("offset"), localOffset);
	if (!found) {
		LOG_AM_WARNING(MSGID_SYSTIME_NO_OFFSET,0,
			"System Time message is missing timezone offset");
	} else {
		LOG_AM_DEBUG("System Time timezone offset: %lld",
			(long long)localOffset);

		localOffset *= 60;

		SetLocalOffset((off_t)localOffset);
	}

	/* The time changed response can also trip if the actual time(2) has
	 * been updated, which should cause a recalculation also of the
	 * interval schedules (at least if 'skip' is set) */
	TimeChanged();
}
Beispiel #2
0
void ObjectSelection::SetCurrentTime(int t)
{
	Time = t;
	emit TimeChanged();
}