Python Forum
Monitor Computer Internal Clock
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Monitor Computer Internal Clock
#1
I'm working on my first Python program. I need to set up an internal timer so that an equation will be solved to produce updated data at 1 second intervals in real time. I've been through several books and a number of online docs and I can't find out how to do monitor the computer's internal clock using Python.

Thanks for any help!

Tom
Reply
#2
Look at the time and schedule modules.

It is difficult to think of a reason why you had a difficult time finding these very common features. Did you look at them and found them a bad fit? What are your real-time requirements? What python are you running and on what OS?
Reply
#3
(May-09-2025, 03:09 PM)deanhystad Wrote: What python are you running and on what OS?
Python 3.13 and Windows 11 64 bit

(May-09-2025, 03:09 PM)deanhystad Wrote: Did you look at them and found them a bad fit?
As I stated this *is* my first attempt at a Python program. Schedule doesn't seem appropriate, and the many, many options in Time are overwhelming and seem more concerned with 'what time is it?' than simply providing time increments.

(May-09-2025, 03:09 PM)deanhystad Wrote: What are your real-time requirements?

I have an object onscreen rotating on its pitch axis at a rate of +3-deg/sec. To achieve reasonably smooth motion, I need to redraw it every 0.1 seconds. How do I sync the re-drawing to occur every 0.1 secs? Can I create, or use some kind of a timer, or do I have to get the time on the computer clock, increment it by 0.1 second, then continuously check it until 0.1 secs have elapsed to commence the redraw for each cycle? I'd like to be able to do a few other calculations in between the re-draw cycles, but I can't miss that 0.1 sec interval or I'll lose sync.
Reply
#4
Did you look at sched or schedule? You are right about sched, it is not a great fit for your task. schedule does exactly what you describe in you post. The only downside I see is it isn't super accurate.

https://pypi.org/project/schedule/
https://schedule.readthedocs.io/en/stable/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Alarm Clock [tkinter] moon 5 1,820 Aug-07-2024, 05:44 PM
Last Post: deanhystad
  World Clock syntax error OscarBoots 1 1,224 May-03-2024, 05:20 AM
Last Post: snippsat
  Is it possible to make a program recognize how many clicks it has had on the monitor? jao 0 1,662 Feb-25-2022, 06:31 PM
Last Post: jao
  Module 'time' has no attribute 'clock' Sophie 4 5,574 Jan-25-2022, 08:05 PM
Last Post: Sophie
  Clock\time calculation script Drone4four 3 2,838 Jan-21-2022, 03:44 PM
Last Post: ibreeden
  web socket server handle onnection closed abnormally [internal]) korenron 0 3,061 Sep-23-2021, 09:26 AM
Last Post: korenron
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 4,117 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  500 internal server error Nitil 1 4,001 May-01-2021, 06:16 PM
Last Post: snippsat
  time.clock not functioning Oldman45 3 3,944 Apr-07-2021, 08:51 AM
Last Post: Oldman45
  Monitor specific line of code from website Olimpiarob 1 2,498 Jul-09-2020, 03:20 PM
Last Post: mrdominikku

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020