Skip to content

corrected issue with minute and hour values#14

Open
ritvikRC wants to merge 1 commit intoArieleg:masterfrom
ritvikRC:master
Open

corrected issue with minute and hour values#14
ritvikRC wants to merge 1 commit intoArieleg:masterfrom
ritvikRC:master

Conversation

@ritvikRC
Copy link

The problem with previous code was that the hours and minutes are passed in as float to string.format.
string.format with "%02d" on float values rounds the values UP OR DOWN to the closest integer instead of rounding them ONLY DOWN to the closest integer.

The result of the previous code was that if the seconds value was greater than 30, the minutes value would be incorrectly incremented by 1.
Similarly, if the minute value was greater than 30, the hour value would be incorrectly incremented by 1.

The problem with previous code was that the hours and minutes are passed in as float to string.format.
string.format with "%02d" on float values rounds the values up or down to the nearest integer instead of rounding them down to the closest integer.

The result of the previous code was that if the seconds value was greater than 30, the minutes value would be incorrectly incremented by 1.
Similarly, if the minute value was greater than 30, the hour value would be incorrectly incremented by 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments