mirror of
https://github.com/zs-yg/kortapp-z.git
synced 2025-12-07 00:20:43 +08:00
添加内存锻炼器代码
This commit is contained in:
23
others/C/memory/src/utils.c
Normal file
23
others/C/memory/src/utils.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "../include/utils.h"
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// MB转字节
|
||||
size_t mb_to_bytes(size_t mb) {
|
||||
return mb * 1024 * 1024;
|
||||
}
|
||||
|
||||
// 获取当前时间戳(毫秒)
|
||||
long long get_timestamp() {
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
return (long long)st.wMilliseconds +
|
||||
st.wSecond * 1000LL +
|
||||
st.wMinute * 60000LL +
|
||||
st.wHour * 3600000LL;
|
||||
}
|
||||
|
||||
// 打印调试信息(支持中文)
|
||||
void debug_print(const wchar_t* message) {
|
||||
wprintf(L"[DEBUG] %s\n", message);
|
||||
}
|
||||
Reference in New Issue
Block a user