Sheba, the realm of Tux
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.

37 lines
1.1 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh
  6. # Copyright (C) 2008 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. # based on http://www.thedjbway.org/clocksd/index.html
  16. exec 2>&1
  17. WAIT=$( expr 9 \* 3600 ) # first in 9 hours
  18. WAIT_MAX=$( expr 7 \* 24 \* 3600 ) # at least once per week
  19. # loop indefinitely
  20. while true; do
  21. echo "Waiting ${WAIT} seconds until next adjustment..."
  22. sleep ${WAIT}
  23. # obtain timing mark for calibrating clockspeed adjust:
  24. clockctl mark
  25. # log current "attoseconds":
  26. clockctl atto
  27. echo "==="
  28. if [ $WAIT -lt $WAIT_MAX ]; then
  29. WAIT=$( expr $WAIT \* 2 )
  30. [ $WAIT -le $WAIT_MAX ] || WAIT=$WAIT_MAX
  31. fi
  32. done