tcl maths problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf tcl maths problem

  • Creator
    Topic
  • #50891
    David Harrison
    Participant

      QDX 5.6 on Solaris 10

      I

    Viewing 7 reply threads
    • Author
      Replies
      • #67925
        Keith McLeod
        Participant

          Try dividing by 60 to get your hours an then use the mod operator to get the remaining minutes.

          $x/60 for hours

          $x%60 for minutes

          141/60 = 2

          141%60 = 21

          Hope this helps….  I am sure there are other ways….

        • #67926
          David Harrison
          Participant

            That’s a lot easier than the way I eventually came up with.

            Thanks

          • #67927
            Robert Milfajt
            Participant

              Quote:

              If

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #67928
              David Harrison
              Participant

                Thanks for that Robert.

                I presume the gmt flag just says ignore local time zone so it will always work no matter what timezone you happen to live in.

              • #67929
                Robert Milfajt
                Participant

                  Yes, but in a roundabout way.  With -gmt, if the next argument is false says use local time, else use GMT.

                  Did that work for you?  I did learn the UK has only one time zone, which is GMT, which sort of puts a wrench in my logic.  However, if you are on a machine that did not flip from standard to savings time, or vice versa, it may explain why you were an hour off.

                  Cheers,

                  Bob

                  Robert Milfajt
                  Northwestern Medicine
                  Chicago, IL

                • #67930
                  David Harrison
                  Participant

                    The CIA World Factbook lists the comparative size of the United Kingdom as ‘slightly smaller than Oregon’, so yes, we only have one timezone.

                    We are currently in British Summer Time (BST) which is one hour ahead of GMT so I suppose that accounts for the extra hour.

                  • #67931
                    garry r fisher
                    Participant

                      Hi David,

                      What happens if you don’t happen to know how big Oregon is?

                      Shouldn’t clock format pick up the local settings on the server and use these when doing this type of calculation? Or is this only true when getting a date/time directly rather than doing a calculation?

                      I haven’t tested this but that’s how I thought it worked.

                      Regards

                      Garry

                    • #67932
                      David Harrison
                      Participant

                        Garry,

                        Easy, Oregon is slightly bigger than the UK!

                        My understanding is that the local settings will be bypassed if you use the -gmt flag. This is what I wanted to do – just to convert a number of minutes into hours and minutes, not time.

                        Regards,

                        Dave

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