Source
this._time_offset -= (now.getTimezoneOffset() * 60 + response.clock_data.time_zone_offset) * 1000;
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
class CWidgetClock extends CWidget {
static TYPE_ANALOG = 0;
static TYPE_DIGITAL = 1;
static HOUR_TWENTY_FOUR = 0;
static HOUR_TWELVE = 1;
static TIMEZONE_SHORT = 0;
static TIMEZONE_FULL = 1;
static TIMEZONE_LOCAL = 'local';
static SHOW_DATE = 1;
static SHOW_TIME = 2;
static SHOW_TIMEZONE = 3;
static DEFAULT_LOCALE = 'en-US';
onInitialize() {
this._time_offset = 0;
this._interval_id = null;
this._clock_type = CWidgetClock.TYPE_ANALOG;
this._time_zone = null;
this._show_seconds = true;
this._time_format = 0;
this._tzone_format = 0;
this._show = [];
this._has_contents = false;
this._is_enabled = true;
}
onStart() {
this._events.resize = () => {
const margin = 5;
const padding = 10;
const header_height = this.getViewMode() === ZBX_WIDGET_VIEW_MODE_HIDDEN_HEADER
? 0
: this._header.offsetHeight;
this._target.style.setProperty(
'--content-height',
`${this._cell_height * this._pos.height - margin * 2 - padding * 2 - header_height}px`
);
}
}
onActivate() {
this._startClock();