1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

TIMER OFF doesn't work

Discussion in 'Support' started by Rod Savard, Jan 10, 2013.

  1. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    TIMER OFF behaves just like TIMER. TIMER ON works as expected.

    I reproduced this on two machines, two different recent builds:

    TCC 14.03.54 x64 Windows 7 [Version 6.1.7601]
    TCC 14.03.53 x64 Windows 7 [Version 6.1.7601]
     
  2. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    402
    Likes Received:
    2
    If the timer is already off, timer off will start a timer instead of reporting an error.

    D:\>timer on
    Timer 1 on: 9:39:04

    D:\>timer off
    Timer 1 off: 9:39:06 Elapsed: 0:00:01.22

    D:\>timer off
    Timer 1 on: 9:39:07

    TCC 14.03.54 Windows 7 [Version 6.1.7601]
    TCC Build 54 Windows 7 Build 7601 Service Pack 1
    Tim
     
  3. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    Yes, that is the behavior I see. Is this actually by design? The help file for TIMER doesn't seem to indicate this behavior for the OFF option.

    I want the ability to ensure the timer is off.
     
  4. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    402
    Likes Received:
    2
    The documentation indicates the (our) expected behavior.

    OFF Force the stopwatch to stop

    The documentation does not mention OFF as a start option. There is either a defect in behavior or in documentation. My guess is on behavior, but we need to wait for Rex on that.

    Tim
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Verified: TCC 14.03.54 Windows XP [Version 5.1.2600]

    I also noted that TIMER /S start the timer if it was not running already.

    I further noted that REDIRECTING standard output from the TIMER command works only when the command STOPS the timer. For any other mode the command output goes to the screen, even when redirecting both standard output AND standard error.

    Lastly, I think the documentation should display the command syntax thus:
    TIMER [/1 | /2 | /3] [/Q] [/S | ON [command] | OFF | [command] ]
    This applies both to the quick help and the help page, and is intended to indicate that
    1/ options /1, /2 and /3 are mutually exclusive, but independent from the other groups
    2/ option /Q is independent of all other options (but it makes no sense when combined with the /S option)
    3/ options /S, ON and OFF are logically mutually exclusive (though /S combined with ON or OFF may not be reported as errors, but the effect of combining two or all three do not result in a dependable operation); specifying command to be timed is valid only when the ON option is used either explicitly or implicitly, but not when either the /S or the OFF option is used.

    My current tests indicate that executing TIMER OFF /S when timer 1 is already off starts it; executing it when it is running the OFF is ignored, regardless of the order of the options. Combining all three options /S, ON and OFF the outcome depends on the order of the options and the current state of the timer. I did not go through all 24 combinations of multiple option selection, option order, and previous timer state. IMHO it would be best if the parser would declare any combination of these options to be error.
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    WAD -- this was changed when the ability to time commands was added. There was a discussion at the time & the general consensus was that since there wasn't any reason to do a "timer off" when you weren't running a timer, it didn't impose much of a burden.
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    Why was it changed ... in case you wanted to time OFF.EXE or OFF.BTM? It *is* an inconvenience to say I want the timer off only to have it started!
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    Why do you want want to turn the timer off if it's already off??
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    What I don't know if it's on or off. That has often been the case when I'm trying to time something to make a point here in the forums and it takes a few tries to get my command error-free. The point is there's no way to force it to be off. The only old thread I could find on the subject was rather one-sided. You said "this is how it is now" and others offered alternatives like "timer ... /cmd <command>" and "timer ... (<command>)" (as with DO).
     
  10. thedave

    Joined:
    Nov 13, 2008
    Messages:
    253
    Likes Received:
    2
    What if I don't know the current state, but know that I want it off? Or put another way, why should the current state matter? If the instruction is to turn it off, why not just turn it off consistently regardless of the current state? Is this intended to be a toggle?
     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    As it works today in 14.03.54, the 2-command sequence "TIMER /S %+ TIMER" will turn it off. The first command is "do nothing" if it is already on, but it starts it if it was off; the second command will turn it off. It is certainly not as nice as the original design - "OFF" meat OFF!
     
  12. JohnQSmith

    Joined:
    Jan 19, 2011
    Messages:
    559
    Likes Received:
    7
    The current mode of operation violates POLA.
     
  13. Frank

    Joined:
    Aug 2, 2011
    Messages:
    258
    Likes Received:
    4
    That's my opinion, too.
    I stumbled over this behavior a while ago and it drives me crazy that "off" turns the timer "on".
     
  14. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    In my case I was running a batch file that did various "timer & command & timer" things. I was troubleshooting something and would break out (CTRL+C) of the batch file and re-run it. This was causing issues with the timer if I broke out while "command" was running. I tried putting "timer off" at the beginning and I was surprised that "timer off" will turn it back on if it was off.
     
  15. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    It doesn't matter -- if you run TIMER ON again, it will reset to the current time & it doesn't matter whether it was previously on or off.
     
  16. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    402
    Likes Received:
    2
    The current documentation states that off is off, not on. That is inaccurate with the current implementation. If this is WAD, perhaps the documentation should be amended for OFF. To force a timer off, first force it on, then force it off.

    Tim
     
  17. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,859
    Likes Received:
    83
    There seems to be a general misconception that when a timer is active, there's something running in the background that has to be turned "off" before anything else can be done. This is not true -- a "timer on" (or just "timer" if no timer is active) simply saves the current time. The next "timer" (or "timer off") gets the current time, subtracts the saved time, displays the result, and clears the flag indicating that a timer is active.

    A "timer off" is never necessary to reset a timer -- just do another "timer on" and the old saved time is replaced by the new time.

    Or, just do a "timer command" and you don't have to worry about "timer on" or "timer off".

    This thread conforms to the POLS (Principle of Least Significance) -- the less significant the issue, the more passionate the arguments. :dead:
     
  18. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,952
    Likes Received:
    30
    I can't believe this has gone on so long. It's just ridiculous that "TIMER OFF" turns the timer on. Many have agree, none have disagreed. In v13, "TIMER OFF" leaves a timer that's off off (just as any reasonable person would expect).
     
  19. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    402
    Likes Received:
    2
    The details behind the implementation are irrelevant. Its about expected behavior. It is not a misconception that with every other iteration of consecutive 'timer off' commands, the documentation is wrong about the expected behavior.

    Tim
     
  20. Rod Savard

    Joined:
    May 26, 2008
    Messages:
    481
    Likes Received:
    3
    Exactly..... TIMER OFF should never turn it back on! Just as TIMER ON should never turn it off!
     
  21. K_Meinhard

    Joined:
    May 20, 2008
    Messages:
    310
    Likes Received:
    0
    You know you'll never get the admission that TIMER OFF switches the timer On is dumb. Some day the behaviour will quietly and miraculously change...
     
  22. Frank

    Joined:
    Aug 2, 2011
    Messages:
    258
    Likes Received:
    4
    Perhaps Rex should wipe out the "Off" option. From program and documentation.
     

Share This Page