mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit
BREAKING CHANGE: all renamed yutil public APIs require downstream
to update function names. Deleted APIs require code changes:
- get_time_us: use y_gettime() for ms timestamps
- get_time_delta: use y_gettime() - start instead
- sleep_s: use y_sleep(ms) with millisecond argument
- wcsreplace: no replacement, had zero callers
- cmdsplit: WinMain now uses __argc/__argv from CRT
- timer_list_*: migrated to ptk timer_scheduler_*;
ptk_reset_timer still available for external use
22 lines
564 B
C
22 lines
564 B
C
#include "test.h"
|
|
#include "libtest.h"
|
|
#include <stdint.h>
|
|
#include "yutil/keywords.h"
|
|
#include "yutil/time.h"
|
|
|
|
void test_time(void)
|
|
{
|
|
int64_t time1 = y_gettime();
|
|
it_b("y_gettime() should work", time1 != 0, true);
|
|
|
|
y_sleep(1000);
|
|
|
|
it_b("y_gettime() subtraction should work", y_gettime() - time1 != 0,
|
|
true);
|
|
it_b("y_sleep() should work", y_gettime() - time1 >= 900, true);
|
|
|
|
int64_t time2 = y_gettime();
|
|
y_sleep(100);
|
|
it_b("y_sleep() should work", y_gettime() - time2 >= 90, true);
|
|
}
|