Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constants for test_formed_timestamp_usec() #913

Merged
merged 2 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Major changes to the IOCCC entry toolkit

## Release 1.2.4 2024-07-14

Add constants for `test_formed_timestamp_usec()` in `entry_util.c`.


## Release 1.2.3 2024-07-12

Expand Down
2 changes: 1 addition & 1 deletion dbg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ picky: ${ALL_SRC}
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down
2 changes: 1 addition & 1 deletion dyn_array/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ picky: ${ALL_SRC}
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down
2 changes: 1 addition & 1 deletion jparse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ picky: ${ALL_SRC} test_jparse/Makefile
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down
2 changes: 1 addition & 1 deletion jparse/test_jparse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ picky: ${ALL_SRC}
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down
2 changes: 1 addition & 1 deletion soup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ picky: ${ALL_SRC}
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down
9 changes: 5 additions & 4 deletions soup/entry_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2992,13 +2992,14 @@ test_formed_timestamp_usec(int formed_timestamp_usec)
/*
* validate count
*/
if (formed_timestamp_usec < 0) {
if (formed_timestamp_usec < MIN_FORMED_TIMESTAMP_USEC) {
json_dbg(JSON_DBG_MED, __func__,
"invalid: formed_timestamp_usec: %d < 0", formed_timestamp_usec);
"invalid: formed_timestamp_usec: %d < %d", formed_timestamp_usec, MIN_FORMED_TIMESTAMP_USEC);
return false;
} else if (formed_timestamp_usec > 999999) {
} else if (formed_timestamp_usec > MAX_FORMED_TIMESTAMP_USEC) {
json_dbg(JSON_DBG_MED, __func__,
"invalid: formed_timestamp_usec: %d > 999999", formed_timestamp_usec);
"invalid: formed_timestamp_usec: %d > MAX_FORMED_TIMESTAMP_USEC %d", formed_timestamp_usec,
MAX_FORMED_TIMESTAMP_USEC);
return false;
}
json_dbg(JSON_DBG_MED, __func__, "formed_timestamp_usec is valid");
Expand Down
3 changes: 3 additions & 0 deletions soup/limit_ioccc.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
#define MAX_TIMESTAMP_LEN (48) /* 28 + 20 more padding for locate */
#define MAX_CLOCK_ERROR ((42*60)-1) /* maximum seconds allowed for a clock to be in error */

#define MIN_FORMED_TIMESTAMP_USEC (1) /* minimum formed_timestamp_usec value */
#define MAX_FORMED_TIMESTAMP_USEC (999999) /* maximum formed_timestamp_usec value */

/*
* Be careful not to change this value as it will invalidate all IOCCC timestamps < this value
*/
Expand Down
2 changes: 1 addition & 1 deletion test_ioccc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ picky: ${ALL_SRC}
echo 1>&2; \
echo 'See the following GitHub repo for ${PICKY}:'; 1>&2; \
echo 1>&2; \
echo ' https://github.com/xexyl/picky' 1>&2; \
echo ' https://github.com/lcn2/picky' 1>&2; \
echo 1>&2; \
exit 1; \
else \
Expand Down