MIX and TransSECS both support setting the date/time on the system on which they are running.

This wiki page is specific to Windows but many concepts apply to other OSs. For Linux specifics see Setting the Date and Time on Linux from MIX and TransSECS Applications

To do this, the property

date.setter

and

date.dateformat

must be configured in the mix.properties (MIX) or ErgoTechConfiguration.properties (TransSECS).

For example:

date.setter=settime.bat
date.dateformat=MM-dd-yy  HH:mm:ss

The date.dateformat uses the Java symbols for time/date to specify the format (reference: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html). Do not use .ms on the ss (seconds) for the Windows time format.

settime.bat should contain something such as:

rem - date format expected is dependent on locale, for example 03-31-21 13:44:16 in the U.S.
rem - run date /? on the command line to see the locale format. Format is set in property date.dateformat.
echo %1 > date.txt
echo %2 > time.txt
date %1 & time %2

In this batch file, the echo statements just print a file for debugging so you can check the time and date parameters sent from TransSECS or MIX when this batch file is called. These echo statements can be removed once debugging is complete.

On Windows the date is set by the “date” command and the time with the “time” command. Both of these require administrative privileges, or, more specifically, the logged in user must have the privilege to set the system time from the command line.

To see what the logged in user is, type “whoami” in a command shell.

To make the logged in user able to change the system time, use the Windows Local Security Policy editor, per instructions here:

https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/change-the-system-time and https://www.tenforums.com/tutorials/92910-allow-prevent-users-groups-change-time-windows-10-a.html

When complete the user (for example Win7Pro) will be added to the “Change the System Time” policy.

Be sure to log-out and log back in again to make these changes effective.

To test whether or not the logged in user has the sufficient privileges, open a command shell and test setting the time, using:

time HH:mm:ss 

(where HH:mm:ss is the time, such as 13:44:05).

If successful you will see the time change. If not successful you will see a message:

A required privilege is not held by the client.
  • windows_setting_the_date_and_time_from_secs.txt
  • Last modified: 2021/04/09 18:16
  • by wikiadmin