Subtracting one minute

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Subtracting one minute

  • Creator
    Topic
  • #52416
    David Harrison
    Participant

      I need to subtract one minute from the time and date if it is midnight. The datetime is presented as CCYYMMDDHHMM. I found the following code but it only works if there is a space between the date and time:

      Code:

      sset time “20110419 0000”
      set format “%Y%m%d%H%M”
      set time [clock format [clock scan “-1 minute” -base [clock scan $time]] -format $format]
      puts $time

      201104182359


      If I remove the space I get:

      Code:

      set time “201104190000”
      set format “%Y%m%d%H%M”
      set time [clock format [clock scan “-1 minute” -base [clock scan $time]] -format $format]
      puts $time

      7393106182359


      Any clues welcome.

    Viewing 10 reply threads
    • Author
      Replies
      • #74129
        Ron Ridley
        Participant

          Have you tried passing in -format $format in your clock scan call?

          Code:


          set time [clock format [clock scan “-1 minute” -base [clock scan $time -format $format]] -format $format]

        • #74130
          David Harrison
          Participant

            That did it. Thank you.

          • #74131
            Gene Salay
            Participant

              This code doesn’t seem to work in 5.8 on AIX with TCL 8.4.    

              Did the -format option for clock scan pass away at some point?

            • #74132
              Bakha Nurzhanov
              Participant

                I believe clock scan -format option gets introduced in Tcl 8.5

              • #74133
                Gene Salay
                Participant

                  What version of Cloverleaf began support for TCL 8.5?

                • #74134
                  Gene Salay
                  Participant

                    Also, why can’t I search for “8.5” on Clovertech?

                  • #74135
                    Peter Heggie
                    Participant

                      My release notes for v5.8.5 states that Tcl 8.4.12 is supported/included.

                      Peter Heggie

                    • #74136
                      John Mercogliano
                      Participant

                        David,

                         Here is a link that discusses your issue with the clock command in detail.

                        <a href="https://usspvlclovertch2.infor.com/viewtopic.php?t=2613&highlight=&#8221; class=”bbcode_url”>https://usspvlclovertch2.infor.com/viewtopic.php?t=2613&highlight=

                        Hopefully, in 6.0 they go to 8.5 where clock uses 64 bit int and we don’t have to worry about running out of dates.  We occasionally have people fat finger future dates that are out of bounds of tcls range.  It would be nice not to have to worry about that.

                        John Mercogliano
                        Sentara Healthcare
                        Hampton Roads, VA

                      • #74137
                        Gene Salay
                        Participant

                          Ok, I’m feeling like the dunce in the room.   Can anyone answer this: How, back on Tuesday April 19, 2011, were Ron Ridley and David Harrison using TCL 8.5 to get the -format option to work for the clock command if, on Saturday, November 3, 2012, TCL 8.5 is still not included in Cloverleaf?

                        • #74138
                          David Harrison
                          Participant

                            Gene,

                            Yes I was a bit confused as well. I

                          • #74139
                            Gene Salay
                            Participant

                              Thanks David, but not entirely.     Apparently it WAS working for Ron?

                              Is it possible to install a later TCL on your CIS box?

                              And again, can anyone answer why searching for 8.5 in Clovertech fails?

                              Thanks!

                          Viewing 10 reply threads
                          • The forum ‘Cloverleaf’ is closed to new topics and replies.