]>
git.saurik.com Git - apple/xnu.git/blob - tools/tests/darwintests/mach_boottime_usec.c
5 #include <sys/sysctl.h>
6 #include <mach/mach_time.h>
8 #include <darwintest.h>
10 T_DECL(mach_boottime_usec
, "mach_boottime_usec()",
11 T_META_ALL_VALID_ARCHS(true), T_META_LTEPHASE(LTE_POSTINIT
))
13 uint64_t bt_usec
= mach_boottime_usec();
16 size_t len
= sizeof(bt_tv
);
17 T_ASSERT_POSIX_SUCCESS(sysctlbyname("kern.boottime", &bt_tv
, &len
, NULL
, 0), NULL
);
19 T_EXPECT_EQ((uint64_t)bt_tv
.tv_sec
* USEC_PER_SEC
+ (uint64_t)bt_tv
.tv_usec
, bt_usec
, NULL
);