freezegun icon indicating copy to clipboard operation
freezegun copied to clipboard

1 min difference when using `auto_tick_seconds`

Open gerazenobi opened this issue 1 year ago • 0 comments

I am using freezegun to set the time a particular datetime and have automatic tick of 10 seconds.

However at the first ticket, instead of observing a 10 seconds delta, 1 minute is observed. The second tick is correct and of 10 seconds.

def test_freeze():
    now = datetime.utcnow()
    with freeze_time(now, auto_tick_seconds=10):
        now_plus_10_seconds = datetime.utcnow()
        now_plus_20_seconds = datetime.utcnow()
        print(now) 
        print(now_plus_10_seconds) 
        print(now_plus_20_seconds)

prints:

2023-05-23 12:23:57.662732
2023-05-23 12:24:57.662732      # 1 min difference with now instead of 10 seconds
2023-05-23 12:25:07.662732      # 1 min and 10 seconds difference with now instead of 20. Correct diff with now_plus_10_seconds

versions

freezegun          1.2.2
Python 3.9.16

gerazenobi avatar May 23 '23 12:05 gerazenobi