Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

linux - Set the hardware clock in Python?

How do I set the hardware clock with Python on embedded Linux systems?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Probably no easy way other than doing an os.system() call.

import os
os.system('hwclock --set %s' % date_str)

or using the 'date' command

import os
os.system('date -s %s' % date_str)

or if you are dying to do some c coding, wrapping the system calls with swig... but I think that would be more work than its worth.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...