-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade scrotSleep() to scrotWaitUntil() which sleeps until a given time on the clock rather than sleeping for a given period of time. In all cases, this improves the timing by compensating for the time passed between entering main() and taking the screenshot. When used with --count, it fixes the drift caused by calling nanosleep() in a loop. Also remove an incorrect comment and rename the delay_selection variable to delaySelection to match our style.
- Loading branch information
Showing
6 changed files
with
73 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* util.h | ||
Copyright 2021 Guilherme Janczak <[email protected]> | ||
Copyright 2021,2023 Guilherme Janczak <[email protected]> | ||
Copyright 2023 NRK <[email protected]> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
|
@@ -26,6 +26,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
|
||
#pragma once | ||
|
||
#include <time.h> | ||
|
||
/* On Linux, CLOCK_MONOTONIC does not progress while the system is suspended, | ||
* and an alternative non-standard clock which does not suffer from this problem | ||
* called CLOCK_BOOTTIME is available. Scrot's CONTINUOUS_CLOCK has the exact | ||
* same semantics as CLOCK_MONOTONIC, only it avoids this bug. | ||
*/ | ||
#if defined(__linux__) | ||
#define CONTINUOUS_CLOCK CLOCK_BOOTTIME | ||
#else | ||
#define CONTINUOUS_CLOCK CLOCK_MONOTONIC | ||
#endif | ||
|
||
#define ARRAY_COUNT(X) (sizeof(X) / sizeof(0[X])) | ||
#define MAX(A, B) ((A) > (B) ? (A) : (B)) | ||
|
||
|