Skip to content

Commit

Permalink
Fix _dateStr() for large time_t values (fixed regression on Linux)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcgurevitx authored and borgi committed Nov 21, 2024
1 parent 0ca37f2 commit 1213030
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MiniScript-cpp/src/DateTimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static bool Match(const String s, size_t *posB, const String match) {
String FormatDate(time_t t, String formatSpec) {
tm dateTime;
struct tm *newtime = localtime_r(&t, &dateTime);
if (errno or newtime == nullptr) return ""; // arg t too large
if (newtime == nullptr) return ""; // arg t too large

const int BUFSIZE = 128;
char buffer[BUFSIZE];
Expand Down
1 change: 1 addition & 0 deletions MiniScript-cpp/tests/testDateTimeDateStr.ms
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "qa"

testDateTimeDateStr = function
qa.assertEqual _dateStr(0), "2000-01-01 00:00:00"
qa.assertEqual _dateStr(1e20), ""
end function

Expand Down

0 comments on commit 1213030

Please sign in to comment.