TCL Clock command issue.

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library TCL Clock command issue.

  • Creator
    Topic
  • #52470
    Kirby Knight
    Participant

    I am using the following in a translate pre-proc.

    set dt_time $xlateInVals

    set xlateOutVals  [clock format [clock scan $dt_time] -format %Y%m%d]

    While doing some testing a test patient with a birthday of 1/1/1901 caused the translation to fail.  When I ran it through the testing tool I got the following.

    MESSAGE 1

    Tcl callout error

    erroCode: NONE

    errorInfo:

    unable to convert date-time string “1/1/1901”

       while executing

    “clock scan $dt_time”

    What is the issue here?  Is there a limitation in the TCL clock command or an issue with the logic?

    I change the birthdate to 1/1/1961 and it worked as expected.

Viewing 2 reply threads
  • Author
    Replies
    • #74324
      Vince Angulo
      Participant

      I just read in another thread (“Need end of month”), that using the Tcl clock command for dates before 1903 exceeds the maxint of the Tcl interpreter — that might be your culprit.

    • #74325
      Kirby Knight
      Participant

      Thank you Vince, this is the information I was looking for.

    • #74326
      Bob Richardson
      Participant

      Greetings,

      We ran into this limitation as well when cranking up code to check if a patient is a newborn per our business rules.  

      Here is a TCL snippet of how we handled that situation (1901 or before)

      which is rare but hey!  some people just keep on truckin’ right?

          catch {clock scan $pid_7} return

          # About the year 1901 the clock scan command blows up.

          # If this happens we definitely do not have a newborn – maybe

          # born-again, who knows?

          if {[string is digit $return]} {

               set dob_seconds $return

          } else {

               set dob_seconds 9999999

          }

          set calc_seconds [expr $today_seconds – $dob_seconds]

      In our example the entire proc is a TCL fragment in an Xlate.

      Let me know if you want the entire proc.

      Have fun!

Viewing 2 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10