Skip to content

Commit

Permalink
Avoid using C features which depends on _Generic.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode authored and tschneidereit committed Jun 25, 2019
1 parent 3f54a76 commit 76e9e81
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wasmtime-wasi/sandboxed-system-primitives/src/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,13 @@ static void convert_timestamp(
in /= 1000000000;

// Clamp to the maximum in case it would overflow our system's time_t.
out->tv_sec = in < NUMERIC_MAX(time_t) ? in : NUMERIC_MAX(time_t);
time_t time_max;
switch (sizeof(time_t)) {
case sizeof(int32_t): time_max = INT32_MAX;
case sizeof(int64_t): time_max = INT64_MAX;
default: assert(0 && "Unrecognized time_t type");
}
out->tv_sec = in < time_max ? in : time_max;
}

// Converts the provided timestamps and flags to a set of arguments for
Expand Down

0 comments on commit 76e9e81

Please sign in to comment.