Skip to content
Tcl Source Code Artifact [aa8746b9b5]
Login

Artifact [aa8746b9b5]

Artifact aa8746b9b5b5e495fd15c74febfa1dda61e63390:

Ticket change [aa8746b9b5] - New ticket [0b39decc764e1af1|0b39decc76] <i>clock.test 50.2 fails for negative values in IRIX: broken mktime()</i>. by dexter1 on 2017-01-11 22:48:53.
D 2017-01-11T22:48:53.508
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment Challenge\sS\sserver\sR4400\sMIPS\sprocessor\srunning\sIRIX\s6.5.22m\r\nBuilt\sfrom\s8.6.6\ssource\swith\sMIPSPro\scompiler\s7.4.4\swith\svendor-patches\sapplied.\r\n\r\n'make\stest'\sfails\swith:\r\n\r\n====\sclock-50.2\sformat\s/\sscan\s-2\sas\sa\slocal\stime\sFAILED\r\n====\sContents\sof\stest\scase:\r\n\r\n\s\s\s\sif\s{[catch\s{\r\n\s\s\s\s\s\s\s\sclock\sscan\s\s[clock\sformat\s-2\s-format\s%Y%m%d%H%M%S\s-timezone\s:localtime]\s\r\n\s-format\s%Y%m%d%H%M%S\s-timezone\s:localtime\r\n\s\s\s\s}\sresult]}\s{\r\n\s\s\s\s\s\s\s\sif\s{\s[regexp\s"\stoo\slarge"\s$result]\s}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\sresult\s-2\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s}\r\n\s\s\s\sset\sresult\r\n\r\n----\sResult\swas:\r\n-1\r\n----\sResult\sshould\shave\sbeen\s(exact\smatching):\r\n-2\r\n====\sclock-50.2\sFAILED\r\n\r\nThis\shappens\sonly\swhen\stime\sconversions\sare\sissued\swith\s'-timezone\s:localtime'\soption\sin\sthe\s'clock\sscan'\scommand.\sOmitting\sthis\soption\sor\ssubstituting\sit\swith\s'-timezone\s:Europe/Amsterdam'\swill\sproduce\sthe\scorrect\sresult.\sThis\sis\sbecause\sthe\smktime()\sroutine\sis\scalled\sonly\swhen\s:localtime\sis\sissued,\sin\stclClock.c:899\sto\sbe\sexact.\r\n\r\nFor\scompleteness,\sin\stcl\sthis\sprogram\sshows\sthe\sbug\s(expected\s-2,\sreceived\s-1):\r\n\r\nset\sc\s[clock\sformat\s-2\s-format\s%Y%m%d%H%M%S\s-timezone\s:localtime]\r\nputs\s[clock\sscan\s$c\s-format\s%Y%m%d%H%M%S\s-timezone\s:localtime]\r\n\r\nproduces:\r\n\r\ncyane:~/tcltest>\s../src/tcl8.6.6/unix/tcltest\sclock.tcl\s\r\n-1\r\n\r\nIRIX\slibc\sfunction\smktime()\sis\sold\sand\sbreaks\sfor\spre-1970\stm\sstructs:\sIt\swill\sreturn\s-1\sfor\sall\svalues\sbefore\sthe\sepoch.\r\nOn\sthe\sother\shand,\slocaltime()\saccepts\snegative\sseconds\sand\syields\spre-epoch\stm\sstructs,\sso\sa\sconversion\sand\sback\sconversion\syield\sdifferent\sresults\sfor\snegative\sseconds.\sThis\stest\sprogram\sdemonstrates\sit:\r\n\r\n#include\s<stdio.h>\r\n#include\s<time.h>\r\n\r\nint\smain\s()\r\n{\r\n\s\s\stime_t\sendseconds,\sstartseconds\s=\s-2;\r\n\s\s\sendseconds\s=\smktime(\slocaltime(\s&startseconds\s)\s);\r\n\s\s\s\r\n\s\s\sprintf("conversion\sof\sseconds\s%d\svia\slocaltime\sand\smktime\sis\s%d\\n",startsecon\r\nds,\sendseconds);\r\n\r\n\s\s\sreturn(0);\r\n}\r\n\r\nproduces:\r\n\r\nconversion\sof\sseconds\s-2\svia\slocaltime\sand\smktime\sis\s-1\r\n\r\nI\shave\ssubstituted\sthe\smktime()\sfunction\sin\sIRIX\slibc\swith\sa\smktime.c\simplementation\spulled\sfrom\snetBSD\ssource\sarchive\sand\sthis\sfixes\sthe\sresult\sin\sthe\sC-example\sprogram.\r\n\r\nAdding\sa\sworking\smktime.c\scode\sin\scompat/\sfor\sIRIX\sbuilds\swith\sMIPSPro\scould\swork,\sor\smaybe\sre-route\stimezone\scalls\swith\s:localtime\sto\sa\sdifferent\sfunction\sfor\sIRIX.
J foundin 8.6.6
J is_private 0
J login dexter1
J priority 5\sMedium
J private_contact f6a32afcad2bdbc0e0c91beb6d44f2ddf022a09d
J resolution None
J severity Minor
J status Open
J submitter dexter1
J subsystem 06.\sTime\sMeasurement
J title clock.test\s50.2\sfails\sfor\snegative\svalues\sin\sIRIX:\sbroken\smktime()
J type Bug
K 0b39decc764e1af1eaf27b1a289ae4c5822e069e
U dexter1
Z 0063229817e848ec4d914460233d1af2