Enhance chibicc

This commit is contained in:
Justine Tunney 2020-12-09 04:00:48 -08:00
parent 8da931a7f6
commit 9df2cef4c4
52 changed files with 2606 additions and 2004 deletions

View file

@ -17,13 +17,14 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/calls/struct/timespec.h"
#include "libc/conv/conv.h"
#include "libc/macros.h"
#include "libc/runtime/gc.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/clock.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"
#include "libc/calls/struct/timespec.h"
#include "libc/x/x.h"
TEST(clock_gettime, testClockRealtime) {
@ -31,5 +32,5 @@ TEST(clock_gettime, testClockRealtime) {
struct timespec ts;
EXPECT_NE(-1, gettimeofday(&tv, NULL));
EXPECT_NE(-1, clock_gettime(CLOCK_REALTIME, &ts));
EXPECT_LT((unsigned)abs(ts.tv_sec - tv.tv_sec), 5u);
EXPECT_LT((unsigned)ABS(ts.tv_sec - tv.tv_sec), 5u);
}