Announcement

Collapse
No announcement yet.

PowerTime object, TimeDiff, unable to pass back some optional parameters

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • PowerTime object, TimeDiff, unable to pass back some optional parameters

    When I use the PowerTime object and specifically the method TimeDiff, I am unable to pass back the optional Mseconds& or Ticks& parameters, since the compiler complains that the parameter mismatches definition.

    Code:
    ChunkFinishTime.TimeDiff(ChunkStartTime, lSign, BYVAL 0, BYVAL 0, BYVAL 0, lSeconds)
    compiles fine

    Code:
    ChunkFinishTime.TimeDiff(ChunkStartTime, lSign, BYVAL 0, BYVAL 0, BYVAL 0, lSeconds, lMicroSeconds)
    fails to compile with

    Code:
    Error 480 in C:\PBCC60\Projects\Test\SuperExtractor\SX.BAS(428:111):  Parameter mismatches definition
      Line 428:             ChunkFinishTime.TimeDiff(ChunkStartTime, lSign, BYVAL 0, BYVAL 0, BYVAL 0, lSeconds, lMicroSeconds)
    lSeconds and lMicroSeconds are type LONG INTEGER. I am using PBCC 6.04.0108

    Any thoughts please?

    Thanks
    Robin

  • #2
    MSeconds and Ticks are quads, not longs.

    & for long, && for quad

    Appears you do have a parameter type mismatch.

    Cheers,
    Dale

    Comment


    • #3
      Also, I believe MSeconds is milliSeconds, not microSeconds

      In scientific use milli is abreviated "m" (lower case), upper case "M" is for mega. IMO PowerBASIC should have used lower case m in name for the parameter.

      Micro is abreviated with Greek that looks like lower case "u" with two tails. A lower case u is often used as a substitute.

      Cheers,
      Dale

      Comment


      • #4
        Originally posted by Dale Yarker View Post
        Also, I believe MSeconds is milliSeconds, not microSeconds

        ...
        IMO PowerBASIC should have used lower case m in name for the parameter.
        Cheers,
        OTOH, they are consistent in their naming schema and they are not using SI Units. Properties, methods and parameters are CamelCase.

        Comment


        • #5
          IIRC PowerTime uses a FILETIME internally, which has a resolution of 100 nanoseconds, so microseconds would make sense.
          "Not my circus, not my monkeys."

          Comment


          • #6
            Originally posted by Eric Pearson View Post
            IIRC PowerTime uses a FILETIME internally, which has a resolution of 100 nanoseconds, so microseconds would make sense.
            For the PowerTime object, MSeconds are milliseconds. Ticks are thousands of a millisecond( i.e microseconds).

            Comment


            • #7
              From Help -
              IPowerTime.AddMSeconds Adds milliSeconds
              IPowerTimeMSeconds returns milliSeconds
              IPowerTime.TimeDifF does not specify units for MSeconds but in syntax it clearly ends with "&&".

              CamelClass? where is the hump? My opinion (which I stated it was) is still my opinion.
              Dale

              Comment


              • #8
                Thank you Dale and Stuart. For some reason my PBCC help shows that these are LONG INTs - please see the attached screenshot.

                Agreed that the units are milliseconds, not microseconds - thanks, stupid typo on my part.
                Attached Files

                Comment


                • #9
                  Did quad fix the type mis-match error? A definate disagreement between PBCC Help and PBWin Help.
                  Dale

                  Comment


                  • #10
                    More recent help files and Online help has Quad parameters ".. OPT MSeconds&&, OPT Ticks&&" ) but both params are shown as 'Long' in earlier help files that came with BPCC60 and PBWin10 compilers.
                    Code:
                    #Compile Exe        ' PBCC604
                    #Dim All
                    #Break On
                    #Include "win32api.inc"
                    '------------------/
                    
                    Function PBMain() As Long
                     Local ChunkStartTime, ChunkFinishTime As IPowerTime
                     Local lSign, lDays, lHours, lMins, lSeconds As Long, lMSeconds, lTicks As Quad
                      Let ChunkStartTime = Class "PowerTime"
                      Let ChunkFinishTime = Class "PowerTime"
                      ' StartProcess
                      ChunkStartTime.Now                    ' Get Current time
                      ? "(2 seconds pause (approx)"
                      Sleep 2000
                      ChunkFinishTime.Now                   ' Get new time
                      ?                                     ' show difference
                    
                       ChunkFinishTime.TimeDiff(ChunkStartTime, lSign, lDays, lHours, lMins, lSeconds, lMSeconds, lTicks)
                      ? Using$("TimeDiff: & #days #hours #mins #secs #mSecs #ticks", _
                                IIF$(lSign => 0, "+", "-"), lDays, lHours, lMins, lSeconds, lMSeconds, lTicks)
                      ?
                    
                      ? "Any key to exit"
                      WaitKey$
                    
                    End Function
                    '------------------/PBMain
                    Rgds, Dave

                    Comment

                    Working...
                    X