1
Solved

Date Time Conversion Bug 12p-1p

I've discovered a bug in Date Time Conversion. 

Any conversion from a Time string to Seconds where Time string is between 12:00 PM and 1:00 PM results in an output that is actually in the midnight hour the next day.

I've written conversion routines like this before in javascript and other languages, so I know from experience that an exception subroutine is required for 12-1pm; you can't just add 12 to get 24hr clock time (which works correctly starting at 1:00 PM). If you try, you wind up with exactly this problem. 

Here's a task that very economically demonstrates the problem by round-tripping the conversion from string-->epochseconds-->string. In the demo, a 5:31 works correctly, but 12:31 does not.

<TaskerData sr="" dvi="1" tv="5.9.2">
        <Task sr="task130">
                <cdate>1478637271216</cdate>
                <edate>1583000157430</edate>
                <id>130</id>
                <nme>Testbed</nme>
                <pri>100</pri>
                <Action sr="act0" ve="7">
                        <code>547</code>
                        <Str sr="arg0" ve="3">%txt_startdt</Str>
                        <Str sr="arg1" ve="3">2/24/2020 5:31:00 PM</Str>
                        <Int sr="arg2" val="0"/>
                        <Int sr="arg3" val="0"/>
                        <Int sr="arg4" val="0"/>
                        <Int sr="arg5" val="3"/>
                </Action>
                <Action sr="act1" ve="7">
                        <code>596</code>
                        <Str sr="arg0" ve="3">%txt_startdt</Str>
                        <Int sr="arg1" val="3"/>
                        <Str sr="arg2" ve="3">%int_dtstartsecs</Str>
                        <Int sr="arg3" val="0"/>
                </Action>
                <Action sr="act2" ve="7">
                        <code>596</code>
                        <Str sr="arg0" ve="3">%int_dtstartsecs</Str>
                        <Int sr="arg1" val="4"/>
                        <Str sr="arg2" ve="3">%txt_enddt</Str>
                        <Int sr="arg3" val="0"/>
                </Action>
                <Action sr="act3" ve="7">
                        <code>548</code>
                        <Str sr="arg0" ve="3">%txt_enddt</Str>
                        <Int sr="arg1" val="1"/>
                </Action>
                <Action sr="act4" ve="7">
                        <code>30</code>
                        <Int sr="arg0" val="0"/>
                        <Int sr="arg1" val="5"/>
                        <Int sr="arg2" val="0"/>
                        <Int sr="arg3" val="0"/>
                        <Int sr="arg4" val="0"/>
                </Action>
                <Action sr="act5" ve="7">
                        <code>547</code>
                        <Str sr="arg0" ve="3">%txt_startdt</Str>
                        <Str sr="arg1" ve="3">2/24/2020 12:31:00 PM</Str>
                        <Int sr="arg2" val="0"/>
                        <Int sr="arg3" val="0"/>
                        <Int sr="arg4" val="0"/>
                        <Int sr="arg5" val="3"/>
                </Action>
                <Action sr="act6" ve="7">
                        <code>596</code>
                        <Str sr="arg0" ve="3">%txt_startdt</Str>
                        <Int sr="arg1" val="3"/>
                        <Str sr="arg2" ve="3">%int_dtstartsecs</Str>
                        <Int sr="arg3" val="0"/>
                </Action>
                <Action sr="act7" ve="7">
                        <code>596</code>
                        <Str sr="arg0" ve="3">%int_dtstartsecs</Str>
                        <Int sr="arg1" val="4"/>
                        <Str sr="arg2" ve="3">%txt_enddt</Str>
                        <Int sr="arg3" val="0"/>
                </Action>
                <Action sr="act8" ve="7">
                        <code>548</code>
                        <Str sr="arg0" ve="3">%txt_enddt</Str>
                        <Int sr="arg1" val="1"/>
                </Action>
        </Task>
</TaskerData>

2 replies

Yes, that fixes it. Thanks so much for the quick response.

TAC

Great! :)

Thank you, I think I fixed it! Can you please try this version? https://drive.google.com/file/d/1UfMEt1H6wjlMDdsqByn-flCRqE45PdJ1/view?usp=sharing

Topic is closed for comments