******************************************************************************
*/
+/*
+ ******************************************************************************
+ * BEGIN timeSync plugin goodies.
+ */
+
+/**
+ * Defines the string used for the timeSync config file group.
+ */
+#define CONFGROUPNAME_TIMESYNC "timeSync"
+
+/**
+ * Enable (or disable) the TimeInfo API.
+ */
+#define CONFNAME_TIMESYNC_TIMEINFO_ENABLED "timeInfo.enabled"
+
+/*
+ * END timeSync goodies.
+ ******************************************************************************
+ */
+
#endif /* __CONF_H__ */
################################################################################
-### Copyright (C) 2009-2016 VMware, Inc. All rights reserved.
+### Copyright (C) 2009-2016, 2022 VMware, Inc. All rights reserved.
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of version 2 of the GNU General Public License as
if LINUX
libtimeSync_la_SOURCES += slewLinux.c
libtimeSync_la_SOURCES += pllLinux.c
+libtimeSync_la_SOURCES += timeInfo.c
endif
--- /dev/null
+/*********************************************************
+ * Copyright (C) 2022 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * 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 Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+/**
+ * @file timeInfo.c
+ *
+ * The feature allows tools to subscribe and receive updates from VMX when
+ * time related properties of the host change.
+ */
+
+#include "conf.h"
+#include "timeSync.h"
+#include "system.h"
+#include "vmware/tools/plugin.h"
+
+
+/**
+ * Initialize TimeInfo in TimeSync.
+ *
+ * @param[in] ctx The application context.
+ */
+void
+TimeInfo_Init(ToolsAppCtx *ctx)
+{
+ gboolean timeInfoEnabled =
+ g_key_file_get_boolean(ctx->config,
+ CONFGROUPNAME_TIMESYNC,
+ CONFNAME_TIMESYNC_TIMEINFO_ENABLED,
+ NULL);
+ ASSERT(vmx86_linux);
+ g_debug("%s: TimeInfo support is %senabled.\n",
+ __FUNCTION__, !timeInfoEnabled ? "not " : "");
+}
+
+
+/**
+ * Cleans up internal TimeInfo state.
+ */
+void
+TimeInfo_Shutdown(void)
+{
+}
--- /dev/null
+/*********************************************************
+ * Copyright (C) 2022 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * 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 Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef _TIMEINFO_H_
+#define _TIMEINFO_H_
+
+/**
+ * @file timeInfo.h
+ *
+ * Functions and definitions related to TimeInfo.
+ */
+
+void TimeInfo_Init(ToolsAppCtx *ctx);
+void TimeInfo_Shutdown(void);
+
+#endif /* _TIMEINFO_H_ */
+
#include "vmware/guestrpc/timesync.h"
#include "vmware/tools/plugin.h"
#include "vmware/tools/utils.h"
+#include "timeInfo.h"
#if !defined(__APPLE__)
#include "vm_version.h"
{
TimeSyncData *data = plugin->_private;
+#if defined(__linux__) && !defined(USERWORLD)
+ TimeInfo_Shutdown();
+#endif
if (data->state == TIMESYNC_RUNNING) {
TimeSyncStopLoop(ctx, data);
}
{ TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
};
+#if defined(__linux__) && !defined(USERWORLD)
+ TimeInfo_Init(ctx);
+#endif
data->slewActive = FALSE;
data->slewCorrection = FALSE;
data->slewPercentCorrection = TIMESYNC_PERCENT_CORRECTION;