This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: datetime.datetime.fromtimestamp have different behaviour on windows and mac
Type: behavior Stage: resolved
Components: macOS, Windows Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Inconsistencies with datetime.fromtimestamp(t) when t < 0
View: 36439
Assigned To: Nosy List: Alexandre Ouellet, ammar2, ned.deily, p-ganssle, paul.moore, ronaldoussoren, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-09-20 14:55 by Alexandre Ouellet, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg352853 - (view) Author: Alexandre Ouellet (Alexandre Ouellet) Date: 2019-09-20 14:55
in a python console on a windows machine:

import datetime
d = datetime.datetime.fromtimestamp(0)
d
>datetime.datetime(1969, 12, 31, 19, 0)
d.timestamp()
>OSError: [Errno 22] Invalid argument

on a macOS machine : 

d = datetime.datetime.fromtimestamp(-1)
d
>datetime.datetime(1969, 12, 31, 19, 0)
d.timestamp()
>-1.0

both machines running 3.6.9

I would expect them have the same behaviour.
msg352863 - (view) Author: Ammar Askar (ammar2) * (Python committer) Date: 2019-09-20 15:45
Thanks for the report Alexandre, this has to do with issues with negative numbers in Window's time APIs. There's already a bug open for this, so I've marked it as a duplicate.
msg355820 - (view) Author: Paul Ganssle (p-ganssle) * (Python committer) Date: 2019-11-01 14:40
Changing the superceder here as I think #36439 matches better than #37527.
msg379571 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-25 10:34
Can this issue be closed? Fixing #36439 would also fix this issue.
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82414
2020-10-25 15:02:55eryksunsetstatus: open -> closed
resolution: duplicate
2020-10-25 10:34:13ronaldoussorensetmessages: + msg379571
2019-11-01 14:40:49p-gansslesetstatus: closed -> open

nosy: + p-ganssle
messages: + msg355820

superseder: Timestamp conversion on windows fails with timestamps close to EPOCH -> Inconsistencies with datetime.fromtimestamp(t) when t < 0
resolution: duplicate -> (no value)
2019-09-20 15:45:48ammar2setstatus: open -> closed

superseder: Timestamp conversion on windows fails with timestamps close to EPOCH
nosy: + ammar2

messages: + msg352863
type: crash -> behavior
resolution: duplicate
stage: resolved
2019-09-20 14:55:16Alexandre Ouelletcreate