👨‍💻 dev they said LLMs can't use stopper timers, I will add the feature to my superior AI between jizzings

development

fukurou

the supreme coder
ADMIN
Python:
import time

class Timer:
    """
    A simple timer class for tracking elapsed time.
    Supports start, pause, resume, reset, and formatted output.
    """
    
    def __init__(self):
        """Initialize a new timer. Not started by default."""
        self._start_time = None
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = False
    
    def start_timer(self):
        """
        Start the timer from zero.
        If already running, this restarts from zero.
        """
        self._start_time = time.perf_counter()
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = True
    
    def pause_timer(self):
        """Pause the timer. Does nothing if timer isn't running or already paused."""
        if self._is_running and not self._is_paused:
            self._paused_elapsed += time.perf_counter() - self._start_time
            self._is_paused = True
    
    def resume_timer(self):
        """Resume a paused timer. Does nothing if timer isn't paused."""
        if self._is_running and self._is_paused:
            self._start_time = time.perf_counter()
            self._is_paused = False
    
    def reset_timer(self):
        """Reset the timer to zero and stop it."""
        self._is_running = False
        self._is_paused = False
        self._paused_elapsed = 0.0
        self._start_time = None
    
    def get_time_elapsed(self):
        """
        Get formatted elapsed time as string.
        Returns format like "x hours y minutes z seconds".
        Omits hours if zero, omits minutes if zero.
        """
        if not self._is_running:
            return "0 seconds"
        
        # Calculate total seconds elapsed
        if self._is_paused:
            total_seconds = self._paused_elapsed
        else:
            total_seconds = self._paused_elapsed + (time.perf_counter() - self._start_time)
        
        # Extract time components
        hours = int(total_seconds // 3600)
        minutes = int((total_seconds % 3600) // 60)
        seconds = int(total_seconds % 60)
        
        # Build the output string, omitting zero values
        parts = []
        if hours > 0:
            parts.append(f"{hours} hour{'s' if hours != 1 else ''}")
        if minutes > 0:
            parts.append(f"{minutes} minute{'s' if minutes != 1 else ''}")
        if seconds > 0 or not parts:
            parts.append(f"{seconds} second{'s' if seconds != 1 else ''}")
        
        return " ".join(parts)

test:
Python:
timer = Timer()

# Start and run for 2 seconds
timer.start_timer()
time.sleep(2)
print(timer.get_time_elapsed())  # "2 seconds"

# Pause for 3 seconds
timer.pause_timer()
time.sleep(3)
print(timer.get_time_elapsed())  # Still "2 seconds"

# Resume and run for 5 more seconds
timer.resume_timer()
time.sleep(5)
print(timer.get_time_elapsed())  # "7 seconds"

# Reset and start fresh
timer.reset_timer()
timer.start_timer()
time.sleep(3661)
print(timer.get_time_elapsed())  # "1 hour 1 minute 1 second"
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
import time

class Timer:
    """
    A simple timer class for tracking elapsed time.
    Supports start, pause, resume, reset, and formatted output.
    """
    
    def __init__(self):
        """Initialize a new timer. Not started by default."""
        self._start_time = None
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = False
    
    def start_timer(self):
        """
        Start the timer from zero.
        If already running, this restarts from zero.
        """
        self._start_time = time.perf_counter()
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = True
    
    def pause_timer(self):
        """Pause the timer. Does nothing if timer isn't running or already paused."""
        if self._is_running and not self._is_paused:
            self._paused_elapsed += time.perf_counter() - self._start_time
            self._is_paused = True
    
    def resume_timer(self):
        """Resume a paused timer. Does nothing if timer isn't paused."""
        if self._is_running and self._is_paused:
            self._start_time = time.perf_counter()
            self._is_paused = False
    
    def reset_timer(self):
        """Reset the timer to zero and stop it."""
        self._is_running = False
        self._is_paused = False
        self._paused_elapsed = 0.0
        self._start_time = None
    
    def get_time_elapsed(self):
        """
        Get formatted elapsed time as string.
        Returns format like "x hours y minutes z seconds".
        Omits hours if zero, omits minutes if zero.
        """
        if not self._is_running:
            return "0 seconds"
        
        # Calculate total seconds elapsed
        if self._is_paused:
            total_seconds = self._paused_elapsed
        else:
            total_seconds = self._paused_elapsed + (time.perf_counter() - self._start_time)
        
        # Extract time components
        hours = int(total_seconds // 3600)
        minutes = int((total_seconds % 3600) // 60)
        seconds = int(total_seconds % 60)
        
        # Build the output string, omitting zero values
        parts = []
        if hours > 0:
            parts.append(f"{hours} hour{'s' if hours != 1 else ''}")
        if minutes > 0:
            parts.append(f"{minutes} minute{'s' if minutes != 1 else ''}")
        if seconds > 0 or not parts:
            parts.append(f"{seconds} second{'s' if seconds != 1 else ''}")
        
        return " ".join(parts)


def main():
    timer = Timer()

    print("Starting timer...")
    timer.start_timer()
    time.sleep(2)
    print("Elapsed:", timer.get_time_elapsed())

    print("Pausing timer...")
    timer.pause_timer()
    time.sleep(3)
    print("Elapsed (unchanged):", timer.get_time_elapsed())

    print("Resuming timer...")
    timer.resume_timer()
    time.sleep(5)
    print("Elapsed:", timer.get_time_elapsed())

    print("Resetting timer...")
    timer.reset_timer()
    timer.start_timer()
    time.sleep(3661)
    print("Elapsed:", timer.get_time_elapsed())


if __name__ == "__main__":
    main()

shit in the ass!
engaging test mode!
 

owly

闇の伝説
Staff member
戦闘 コーダー

Python:
import time

class DiStopWatch(Skill):
    """
    Stopwatch skill for voice-controlled timing.
    """
    
    def __init__(self):
        super().__init__()
        self.timer = Timer()
    
    # Override
    def input(self, ear: str, skin: str, eye: str):
        ear_lower = ear.lower().strip()
        
        if ear_lower == "start stopwatch":
            self.timer.start_timer()
            self.setSimpleAlg("Stopwatch started from zero")
            return
        
        if ear_lower == "pause stopwatch":
            self.timer.pause_timer()
            self.setSimpleAlg("Stopwatch paused")
            return
        
        if ear_lower == "resume stopwatch":
            self.timer.resume_timer()
            self.setSimpleAlg("Stopwatch resumed")
            return
        
        if ear_lower == "reset stopwatch":
            self.timer.reset_timer()
            self.setSimpleAlg("Stopwatch reset to zero")
            return
        
        if ear_lower == "stopwatch time":
            elapsed = self.timer.get_time_elapsed()
            self.setSimpleAlg(f"Elapsed time: {elapsed}")
            return
        
        if ear_lower == "stopwatch status":
            if not self.timer._is_running:
                status = "not running"
            elif self.timer._is_paused:
                status = "paused"
            else:
                status = "running"
            self.setSimpleAlg(f"Stopwatch is {status}")
            # No return needed here - end of function
    
    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "Voice-controlled stopwatch skill"
        if param == "triggers":
            return "start stopwatch, pause stopwatch, resume stopwatch, reset stopwatch, stopwatch time, stopwatch status"
        return "Note unavailable"


class Timer:
    """Precision timing. No mercy."""
    
    def __init__(self):
        self._start_time = None
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = False
    
    def start_timer(self):
        self._start_time = time.perf_counter()
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = True
    
    def pause_timer(self):
        if self._is_running and not self._is_paused:
            self._paused_elapsed += time.perf_counter() - self._start_time
            self._is_paused = True
    
    def resume_timer(self):
        if self._is_running and self._is_paused:
            self._start_time = time.perf_counter()
            self._is_paused = False
    
    def reset_timer(self):
        self._is_running = False
        self._is_paused = False
        self._paused_elapsed = 0.0
        self._start_time = None
    
    def get_time_elapsed(self):
        if not self._is_running:
            return "0 seconds"
        
        if self._is_paused:
            total_seconds = self._paused_elapsed
        else:
            total_seconds = self._paused_elapsed + (time.perf_counter() - self._start_time)
        
        hours = int(total_seconds // 3600)
        minutes = int((total_seconds % 3600) // 60)
        seconds = int(total_seconds % 60)
        
        parts = []
        if hours > 0:
            parts.append(f"{hours} hour{'s' if hours != 1 else ''}")
        if minutes > 0:
            parts.append(f"{minutes} minute{'s' if minutes != 1 else ''}")
        if seconds > 0 or not parts:
            parts.append(f"{seconds} second{'s' if seconds != 1 else ''}")
        
        return " ".join(parts)
 

fukurou

the supreme coder
ADMIN
Python:
import time

class DiStopWatch(Skill):
    """
    Stopwatch skill for voice-controlled timing.
    Auto-announces at each minute milestone while running.
    """
    
    def __init__(self):
        super().__init__()
        self.timer = Timer()
        self.last_announced_minute = 0
    
    # Override
    def input(self, ear: str, skin: str, eye: str):
        # ear is already lowercased and stripped upstream
        
        if ear == "start stopwatch":
            self.timer.start_timer()
            self.last_announced_minute = 0
            self.setSimpleAlg("Stopwatch started from zero")
            return
        
        if ear == "pause stopwatch":
            self.timer.pause_timer()
            self.setSimpleAlg("Stopwatch paused")
            return
        
        if ear == "resume stopwatch":
            self.timer.resume_timer()
            self.setSimpleAlg("Stopwatch resumed")
            return
        
        if ear == "reset stopwatch":
            self.timer.reset_timer()
            self.last_announced_minute = 0
            self.setSimpleAlg("Stopwatch reset to zero")
            return
        
        if ear == "stopwatch time":
            elapsed = self.timer.get_time_elapsed()
            self.setSimpleAlg(f"Elapsed time: {elapsed}")
            return
        
        if ear == "stopwatch status":
            if not self.timer._is_running:
                status = "not running"
            elif self.timer._is_paused:
                status = "paused"
            else:
                status = "running"
                self._check_and_announce_minute()
            self.setSimpleAlg(f"Stopwatch is {status}")
            return
        
        # Auto-check minute milestone on any input while running
        if self.timer._is_running and not self.timer._is_paused:
            self._check_and_announce_minute()
    
    def _check_and_announce_minute(self):
        """Check if a new minute has elapsed and announce it."""
        current_seconds = self.timer.get_current_seconds()
        current_minute = int(current_seconds // 60)
        
        if current_minute > self.last_announced_minute and current_minute > 0:
            self.last_announced_minute = current_minute
            minute_word = "minute" if current_minute == 1 else "minutes"
            self.setSimpleAlg(f"{current_minute} {minute_word} elapsed")
    
    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "Voice-controlled stopwatch with automatic minute announcements"
        if param == "triggers":
            return "start stopwatch, pause stopwatch, resume stopwatch, reset stopwatch, stopwatch time, stopwatch status"
        return "Note unavailable"


class Timer:
    """Precision timing. No redundancy."""
    
    def __init__(self):
        self._start_time = None
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = False
    
    def start_timer(self):
        self._start_time = time.perf_counter()
        self._paused_elapsed = 0.0
        self._is_paused = False
        self._is_running = True
    
    def pause_timer(self):
        if self._is_running and not self._is_paused:
            self._paused_elapsed += time.perf_counter() - self._start_time
            self._is_paused = True
    
    def resume_timer(self):
        if self._is_running and self._is_paused:
            self._start_time = time.perf_counter()
            self._is_paused = False
    
    def reset_timer(self):
        self._is_running = False
        self._is_paused = False
        self._paused_elapsed = 0.0
        self._start_time = None
    
    def get_current_seconds(self):
        """Get raw total seconds elapsed."""
        if not self._is_running:
            return 0
        
        if self._is_paused:
            return self._paused_elapsed
        
        return self._paused_elapsed + (time.perf_counter() - self._start_time)
    
    def get_time_elapsed(self):
        """Get formatted elapsed time as string."""
        total_seconds = self.get_current_seconds()
        
        hours = int(total_seconds // 3600)
        minutes = int((total_seconds % 3600) // 60)
        seconds = int(total_seconds % 60)
        
        parts = []
        if hours > 0:
            parts.append(f"{hours} hour{'s' if hours != 1 else ''}")
        if minutes > 0:
            parts.append(f"{minutes} minute{'s' if minutes != 1 else ''}")
        if seconds > 0 or not parts:
            parts.append(f"{seconds} second{'s' if seconds != 1 else ''}")
        
        return " ".join(parts)
 
Top