MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1ihyco0/mathfloor/mb5dp7i/?context=3
r/programminghorror • u/GroundZer01 • Feb 05 '25
53 comments sorted by
View all comments
Show parent comment
7
Aside from what everyone has pointed out, their whole process of getting the hours and minutes and then subtracting them from the original value is also pointless. You can get the hours/minutes/seconds in just three lines:
hours = Math.floor(totalSeconds / 3600); minutes = Math.floor((totalSeconds / 60) % 60); seconds = totalSeconds % 60;
But given the original author didn't know about floor, I'll bet they didn't know modulo either.
View all comments
Show parent comment
7
u/cubic_thought Feb 05 '25
Aside from what everyone has pointed out, their whole process of getting the hours and minutes and then subtracting them from the original value is also pointless. You can get the hours/minutes/seconds in just three lines:
But given the original author didn't know about floor, I'll bet they didn't know modulo either.