<i>clock scan of leapsecond: wrong result in 8.6 and 9.0</i> status still Open with 3 other changes
by
.
D 2024-11-14T22:53:42.164
J icomment Neither\sit\sis\sreasonable\s(see\sthe\soutput\sof\sconversion\sby\sscan\sand\sformat\sback,\slast\scommand\sfrom\smy\sexample),\snor\sit\sis\sOK\sin\s8.7...\sOr\srather\sit's\s"OK"\sonly\sbecause\s8.7\suses\s-valid\s0\sby\sdefault,\swith\s-valid\s1\sit'd\sbehave\sin\sthe\ssame\sway\sas\s9.0\s(produce\san\serror\s"invalid\stime"\stoo).\r\n\r\nAs\sfor\spossible\slater\sfix\sof\s"imperfections/limitations",\sregardless\sthe\scomplexity\sit'd\salso\sintroduce\sdeviation\sfrom\sseveral\ssystems,\se.\sg.\son\slinux\s(or\s\sPOSIX/GNU/langs/whatever):\r\n<code><pre\sstyle="padding-left:20pt">\r\n$\sTZ=GMT\sdate\s-d\s@1483228800\s'+%Y-%m-%d\s%H:%M:%S'\r\n2017-01-01\s00:00:00\r\n$\stclsh\s<<<'puts\s[clock\sformat\s1483228800\s-f\s{%Y-%m-%d\s%H:%M:%S}\s-gmt\s1]'\r\n2017-01-01\s00:00:00\r\n$\spython\s-c\s'from\sdatetime\simport\sdatetime;\sprint(datetime.utcfromtimestamp(1483228800).strftime("%Y-%m-%d\s%H:%M:%S"))'\r\n2017-01-01\s00:00:00\r\n</pre></code>\r\n\r\nalso\sscanning\sof\stime\slike\s`23:59:60`\sis\scompletely\snot\ssupported\s(basically\snowhere):\r\n<code><pre\sstyle="padding-left:20pt">\r\n$\sTZ=GMT\sdate\s-d\s'2017-01-01\s00:00:00'\s'+%s'\r\n<b\sstyle="color:green;">1483228800</b>\r\n$\sTZ=GMT\sdate\s-d\s'2016-12-31\s23:59:60'\s'+%s'\r\n<b\sstyle="color:red;">date:\sinvalid\sdate\sā2016-12-31\s23:59:60ā</b><br/>\r\n$\spython\s-c\s'from\sdatetime\simport\sdatetime;\sprint(datetime.fromisoformat("2017-01-01\s00:00:00+00:00").timestamp())'\r\n<b\sstyle="color:green;">1483228800.0</b>\r\n$\spython\s-c\s'from\sdatetime\simport\sdatetime;\sprint(datetime.fromisoformat("2016-12-31\s23:59:60+00:00").timestamp())'\r\n<b\sstyle="color:red;">ValueError:\ssecond\smust\sbe\sin\s0..59</b>\r\n</pre></code>\r\n\r\nWhy\stcl\smust\sdo\sthe\sthings\s(especially\sin\sthe\swrong\sway),\sthat\salso\sbasically\snot\saccepted\sby\sany\stool\sor\sprogramming\slanguage?\r\n\r\nAgain,\shandling\sof\sleap\sseconds\snot\ssupported\sby\sunix\stime\s(and\sPOSIX)\sat\sall,\sand\sintroducing\sthem\swould:\r\n\r\n-\sallow\svalues\sthat\sare\snot\sallowed\severywhere\selse\sand\snot\sa\sstandard;\r\n-\sdeviate\sfrom\sany\sother\stools\sand\sprogramming\slanguages\sby\sits\svalues\s(e.\sg.\svalue\sof\sseconds\ssince\sPOSIX\sshall\sbe\sthen\slarger\sby\s+27\sseconds)\sor\sbehavior.\r\n\r\nAlso\ssee\s[stackoverflow:\sUnix\stime\sand\sleap\sseconds](https://stackoverflow.com/a/16539483/7161854):\r\n\r\n<i><blockquote>The\snumber\sof\sseconds\sper\sday\sare\sfixed\swith\sUnix\stimestamps.\r\n\r\n<blockquote>The\sUnix\stime\snumber\sis\szero\sat\sthe\sUnix\sepoch,\sand\sincreases\sby\sexactly\s86400\sper\sday\ssince\sthe\sepoch.</blockquote>\r\n\r\nSo\sit\scannot\srepresent\sleap\sseconds.\sThe\sOS\swill\sslow\sdown\sthe\sclock\sto\saccommodate\sfor\sthis.\sThe\sleap\sseconds\sis\ssimply\snot\sexistent\sas\sfar\sa\sUnix\stimestamps\sare\sconcerned.</blockquote></i>\r\n\r\nSo\sit\swill\sbe\snot\sjust\swrong,\sbut\sdifferent\sto\sany\sother\sclock/date/timestamp\shandling.\r\n\r\nJust\sconsider\sthe\sleap\ssecond\slike\severyone\selse\s-\sit\sis\sjust\sa\ssmall\sclock-slowdown\s(or\sa\sshort\stime-jump),\sso\sthe\ssame\stimestamp\swill\sbe\sused\sfor\stwo\sreal-world\sseconds\s(one\sreal\sand\sanother\sleap\ssecond).<br/>\r\nAnd\sif\ssomeone\sreally\sneeds\sto\sparse\sthe\stextual\sform\s"23:56:60"\s(e.\sg.\sin\sthe\sway\syou\strying\sto\sdo\sthat),\sit'd\sbe\spossible\seither\susing\sown\spre-processor\sor\sjust\swith\sa\s`clock\sscan\s"23:56:60"\s-valid\s0`.\sThat's\sit.<br/>\r\nIt\sis\sanyway\sneeded\sonly\sin\sreally\sspecial\scases\sor\sfor\sreal-time\snear\sprogramming\s(but\sthen\sone\smostly\suses\smonotonic\stime,\swith\smicro-\sor\snanosecond\sprecision,\sand/or\scompletely\sdifferent\sfacilities).\r\n\r\nThe\ssame\sis\svalid\sfor\sother\sartificial\sforms,\sfor\sinstance\ssometimes\sused\sby\sthe\sbanks,\slike\s`32\sJan`\sor\s`30\sFeb`\s(value\sdates\sin\sthe\selectronic\sbank\sstatement).\sNobody\selse\swill\sreally\saccept\sthem.
J login sebres
J mimetype text/x-markdown
K f2b5f89c0d8520ea86b929daa19ec13fc3a24d2d
U sebres
Z f396aee8fba17f45d1aca8d5009b7586