Overview
| Artifact ID: | 7a378117354adfb0d8e3c1d7358f97dfbf9a9187a4e584fb0110add48ad67ce7 |
|---|---|
| Ticket: | 16e4fc30961de5dc969639eaef7354022b683102
year int overflow - clock format of very large date / JD is wrong - if switches into negative value (+24 hours difference). |
| User & Date: | sebres on 2019-01-23 17:11:24 |
Changes
- icomment:
I found still another similar issue (because minor, won't open new ticket): <pre style="padding-left:10pt"> % clock format [expr {-210866803200 - 0}] -format {%J -- %Y-%m-%d %T} -gmt true 0000000 -- 4713-01-01 00:00:00 % clock format [expr {-210866803200 - 1}] -format {%J -- %Y-%m-%d %T} -gmt true <b style="color:red">- 0000000 -- 4713-01-01 23:59:59</b> <b style="color:green">+ -000001 -- 4714-12-31 23:59:59</b> % clock format [expr {-210866803200 - 86400}] -format {%J -- %Y-%m-%d %T} -gmt true <b style="color:red">- -000001 -- 4714-12-31 00:00:00</b> <b style="color:green">+ -000002 -- 4714-12-31 00:00:00</b> </pre> Julian day, if traverses over 0 into negative (from year 4713 B.C.E to 4714 B.C.E), becomes negative value first if it is switched a complete day back (24 hours are invalid).<br/> Because julian day used also in the internal calculations, as one can see in the second call (red-marked result), the formated date is therefore totally wrong. Expected value is green-marked. There are 2 variants to fix this:<br/> 1. JD to -1, and seconds of day to 86399 (simplest case to implement or to fix it)<br/> 2. JD to 0, and seconds of day to -1 (more complex case, because at the moment value of day-seconds is rather positive everywhere in internal calculations, thus then many adjustments are necessary in this case). I've fixed it (variant 1) in my internal branches (and tclclockmod), will port it later in sebres-8-6-clock-speedup branch. BTW, I don't understand also, why it has padding 7 at all (and for which reasons it may be necessary). - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- title changed to:
year int overflow - clock format of very large date / JD is wrong - if switches into negative value (+24 hours difference).