Last active
          October 8, 2023 07:26 
        
      - 
      
- 
        Save Vanlightly/d7dd1f19b9cae8f99859b3c81a699fff to your computer and use it in GitHub Desktop. 
    JumpyClock.tla
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ----------------------------- MODULE JumpyClock ----------------------------- | |
| EXTENDS Naturals | |
| VARIABLES hour, minute, second | |
| Init == | |
| /\ hour = 0 | |
| /\ minute = 0 | |
| /\ second = 0 | |
| TotalSeconds(h, m, s) == | |
| s + (m*60) + (h*3600) | |
| IsInFuture(h, m, s) == | |
| TotalSeconds(h, m, s) > TotalSeconds(hour, minute, second) | |
| Tick == | |
| \E next_hour \in 0..23 : | |
| \E next_minute \in 0..59 : | |
| \E next_second \in 0..59 : | |
| /\ IsInFuture(next_hour, next_minute, next_second) | |
| /\ hour' = next_hour | |
| /\ minute' = next_minute | |
| /\ second' = next_second | |
| Next == | |
| Tick | |
| ============================================================================= | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment