Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29061 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2012-09-13 14:07 -0400 |
| Last post | 2012-09-13 14:07 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: datetime Terry Reedy <tjreedy@udel.edu> - 2012-09-13 14:07 -0400
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2012-09-13 14:07 -0400 |
| Subject | Re: datetime |
| Message-ID | <mailman.626.1347559693.27098.python-list@python.org> |
On 9/13/2012 11:19 AM, Max wrote: > How do I set the time in Python? If you look up 'time' in the index of the current manual, it directs you to the time module. "time.clock_settime(clk_id, time) Set the time of the specified clock clk_id. Availability: Unix. New in version 3.3." You did not specify *which* time to set, but ... "time.CLOCK_REALTIME System-wide real-time clock. Setting this clock requires appropriate privileges. Availability: Unix. New in version 3.3." Chris already suggested an approach for changing your process's idea of time. However, setting time.timezone seems to have no effect > Also, is there any *direct* way to shift it? If you mean time.clock_shift(clk_id, shift_seconds), no. time.clock_settime(clk_id, time.clock_gettime(clk_id) + delta_seconds) > Note that any "indirect" methods may need complicated ways to keep > track of the milliseconds lost while running them. Whay would a millisecond matter? System clocks are never synchronized to official UTC time that closely without special hardware to receive time broadcasts. > It even took around one > second in some virtual machine guest systems. So I'm hoping Python happens to > have the magic needed to do the job for me. The above should be well under a second. -- Terry Jan Reedy
Back to top | Article view | comp.lang.python
csiph-web