timer
gotta keep track of how long my breaks are lol
timer
import time
def converter(hours, minutes, seconds):
return hours * 3600 + minutes * 60 + seconds
time.sleep(converter(hrs, mins, secs))
print("time's up")
timer
import time
import sys
time_left = int(input("How long would you like the timer to go (in seconds)? "))
check_for_decimal = time_left % 1
if check_for_decimal not 0:
print("Use a whole number pls")
sys.exit()
if time_left < 1:
print("Please use a number greater than 0.")
sys.exit()
while True:
time.sleep(1)
time_left -= 1
if time_left == 0:
print("Time's up!")
break
# Since I'm such a good programmer (/s), I didn't test this at all :)
# Let me know if there is an error and I will try to fix it.
timer
import time
length = int(input('How many seconds: '))
time.sleep(length)
print('Time is up')
timer
58s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s758s7
timer
import React from 'react';
import { useTimer } from 'react-timer-hook';
function MyTimer({ expiryTimestamp }) {
const {
seconds,
minutes,
hours,
days,
isRunning,
start,
pause,
resume,
restart,
} = useTimer({ expiryTimestamp, onExpire: () => console.warn('onExpire called') });
return (
<div style={{textAlign: 'center'}}>
<h1>react-timer-hook </h1>
<p>Timer Demo</p>
<div style={{fontSize: '100px'}}>
<span>{days}</span>:<span>{hours}</span>:<span>{minutes}</span>:<span>{seconds}</span>
</div>
<p>{isRunning ? 'Running' : 'Not running'}</p>
<button onClick={start}>Start</button>
<button onClick={pause}>Pause</button>
<button onClick={resume}>Resume</button>
<button onClick={() => {
// Restarts to 5 minutes timer
const time = new Date();
time.setSeconds(time.getSeconds() + 300);
restart(time)
}}>Restart</button>
</div>
);
}
export default function App() {
const time = new Date();
time.setSeconds(time.getSeconds() + 600); // 10 minutes timer
return (
<div>
<MyTimer expiryTimestamp={time} />
</div>
);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us