You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

  1. using System;
  2. using System.Diagnostics;
  3. using System.Windows.Forms;
  4. namespace ThunderboltTimeSync {
  5. public partial class FormMain : Form {
  6. public FormMain() {
  7. // Check for admin rights
  8. // If running as admin:
  9. // Ask for COM port with dialog
  10. // Connect to COM port
  11. // When time message received:
  12. // If (time in UTC) AND (last time change was more than $MIN_UPDATE_INTERVAL ago) AND (error is less than $ERROR_THRESHOLD)
  13. // Change system time to GPS time
  14. // Else:
  15. // Display message to tell user to run as admin
  16. // Quit
  17. InitializeComponent();
  18. Debug.WriteLine(SystemTimeUtils.GetSystemTime().ToString("yyyy-MM-ddTHH:mm:ssK.ffff"));
  19. try {
  20. SystemTimeUtils.SetSystemTime(new DateTime(
  21. 2000, 1, 1,
  22. 10, 0, 0, 0
  23. ));
  24. } catch (SystemTimeUtils.SystemTimeException stEx) {
  25. Debug.WriteLine(string.Format("Setting system time failed: \"{0}\"", stEx.Message));
  26. }
  27. Debug.WriteLine(SystemTimeUtils.GetSystemTime().ToString("yyyy-MM-ddTHH:mm:ssK.ffff"));
  28. }
  29. }
  30. }