How do I set the hardware clock with Python on embedded Linux systems?
An updated version on Ubuntu 16.04:
import subprocess
import shlex
subprocess.call(shlex.split("timedatectl set-ntp false")) # May be necessary
subprocess.call(shlex.split("sudo date -s '2 OCT 2006 18:00:00'"))
subprocess.call(shlex.split("sudo hwclock -w"))
Important note: you may need to change the time/date settings to manually set (set-ntp false) or else it will immediately change it back to the current time.
hwclock -w sets the hardware clock based on the current system time (set by date)
It is required that date & hwclock are run as sudo as well.