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: open Resolution:
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 2019-11-01 14:40 by p-ganssle.

Messages (3)
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 triager) 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.
History
Date User Action Args
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 ->
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