BJörn Lindqvist schrieb: > I think it should be a ValueError, given that the programmer is very > likely to further use the returned timestamp to for example insert > stuff in a database. Unix timestamps are not unambiguously defined for > any years other than 1970 to 2038 imho.
IIRC the unix timestamp was originally definied as *signed* int with 32bit. http://en.wikipedia.org/wiki/Time_t --- Unix and POSIX-compliant systems implement the time_t type as a signed integer (typically 32 or 64 bits wide) which represents the number of seconds since the start of the Unix epoch: midnight UTC of January 1, 1970 (not counting leap seconds). Some systems support negative time values, while others do not. --- But you made a good point! What do you think about datetime.totimestamp(asLong=False)? The method would raise a ValueError or OverflowError if the value is > sys.maxint or < -(sys.maxint-1). Christian _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com