Time Synchronization Guide

Manually Set the Time

MeXkey3 supports manually adjusting the system time in the device settings.

Time Format Description: YYYYMMDDHHMMSS

  • 4-digit year + 2-digit month + 2-digit day + 2-digit hour + 2-digit minute + 2-digit second
  • Example: 20250730171212 means July 30, 2025, 17:12:12

Synchronize Time via Command

MeXkey3 supports synchronizing the current computer time through a script command.

Important Note
  • The device only automatically synchronizes the time once per boot.
  • If you need to synchronize manually, please choose the corresponding command according to your operating system.

Linux / macOS Systems

echo -n "timestamp=$(date +%s)" | nc -u -w1 172.16.8.1 22

Windows System

This is a single line command
$timestamp=[int]([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()); $msg=[System.Text.Encoding]::ASCII.GetBytes("timestamp=$timestamp"); $udp=New-Object System.Net.Sockets.UdpClient; $udp.Send($msg, $msg.Length, '172.16.8.1',22); $udp.Close()
Note

If Windows 10 users encounter driver issues, please refer to Manually Install Driver

Automatic Time Synchronization Script

Windows Automatic Synchronization Solution

1. Create the Main Synchronization Script

Create a new MeXkey3_timesync.ps1 file with the following content:

$targetVid = "303a"
$targetPid = "0030"

while ($true) {
    $usbDevices = Get-PnpDevice -Class USB | Where-Object Status -eq "OK"
    
    foreach ($device in $usbDevices) {
        if ($device.InstanceId -like "*VID_$targetVid&PID_$targetPid*") {
            Write-Host "Target USB device detected. Waiting 10 seconds..."
            Start-Sleep -Seconds 10 # Wait 10 seconds before sending the sync command

            $timestamp=[int]([System.DateTimeOffset]::UtcNow.ToUnixTimeSeconds()); 
            $msg=[System.Text.Encoding]::ASCII.GetBytes("timestamp=$timestamp"); 
            $udp=New-Object System.Net.Sockets.UdpClient; 
            $udp.Send($msg, $msg.Length, '172.16.8.1', 22);
            $udp.Close()

            Write-Host "UDP command executed successfully."
            exit
        }
    }
    Start-Sleep -Seconds 5 # Check every 5 seconds if the USB device is connected
}

2. Create a Startup Script

Create a new MeXkey3_timesync_start_hidden.vbs file:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "cmd /c powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File ""MeXkey3_timesync.ps1""", 0, False
Set WshShell = Nothing

3. Configure Auto-start on Boot

  1. Save the two script files in a suitable location.
  2. Right-click MeXkey3_timesync_start_hidden.vbs → Create Shortcut.
  3. Press Win + R keys, type shell:startup to open the Startup folder.
  4. Place the shortcut into the Startup folder.

After completing the setup and restarting the computer, the system will automatically monitor the MeXkey3 connection in the background, automatically synchronize the time 10 seconds after the device is detected, and exit the script after synchronization is complete.