Skip to content

Properly enforce timelimits >= 60s#366

Merged
trestletech merged 1 commit intomasterfrom
time-limit
May 12, 2020
Merged

Properly enforce timelimits >= 60s#366
trestletech merged 1 commit intomasterfrom
time-limit

Conversation

@trestletech
Copy link
Copy Markdown
Contributor

If an exercise had an assigned timelimit of >= 60s, it would never be reaped. This is because by default when you subtract times it becomes a difftime object which will be presented in arbitrary units. Around the 60s mark, you can see we switch from:

> str(Sys.time() - start_time)
 'difftime' num 58.2525360584259
 - attr(*, "units")= chr "secs"

to:

> str(Sys.time() - start_time)
 'difftime' num 1.01057458321253
 - attr(*, "units")= chr "mins"

When you compare on this time, it compares 1 to your assigned time limit and permits it to continue computing.

We need to force the time comparison into seconds in order to accurately compare to our time limit.

If an exercise had an assigned timelimit of >= 60s, it would never be reaped. This is because by default when you subtract times it becomes a `difftime` object which will be presented in arbitrary units. Around the 60s mark, you can see we switch from:

> str(Sys.time() - start_time)
 'difftime' num 58.2525360584259
 - attr(*, "units")= chr "secs"

to:

> str(Sys.time() - start_time)
 'difftime' num 1.01057458321253
 - attr(*, "units")= chr "mins"

When you compare on this time, it compares 1 to your assigned time limit and permits it to continue computing.

We need to force the time comparison into seconds in order to accurately compare to our time limit.
@trestletech trestletech requested a review from schloerke May 12, 2020 16:42
@trestletech trestletech merged commit 1688820 into master May 12, 2020
@trestletech trestletech deleted the time-limit branch May 12, 2020 16:48
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.

2 participants