Skip to content

Total duration of sleep time can exceed 24 hours through entering a very small value for the sleep duration #1911

Open
@nus-se-script

Description

@nus-se-script

image.png

By entering a very small value for the sleep duration, such as 0.001 (which seems to be the point at which it gets rounded down), the sleep entry gets added with a duration of 0 hours, which makes it possible to technically exceed the 24-hour limit placed on total sleep time in a day by an extra 0.001 hours at least once before the program catches it.

Steps to replicate:

  1. sleep add 23.50 d/2024-04-17, which adds a sleep entry with time 23.5 hours
  2. sleep add 0.49 d/2024-04-17, which adds 0.49hrs
    3.sleep add 0.01 d/2024-04-17, which adds 0.01hrs, bringing the total to 24 hours.
  3. sleep add 0.001 d/2024-04-17, which adds an additional 0.001 hrs (but shown as 0 hrs on the output), making the total exceed 24 hours

[original: nus-cs2113-AY2324S2/pe-interim#1694] [original labels: severity.Low type.FunctionalityBug]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions