Closed paradisuman closed 1 year ago
cc: #61 #60
mingw: 和lolly用法一致,可以用库函数的time_t
#ifndef _TIME32_T_DEFINED
#define _TIME32_T_DEFINED
typedef long __time32_t;
#endif
#ifndef _TIME_T_DEFINED
#define _TIME_T_DEFINED
#ifdef _USE_32BIT_TIME_T
typedef __time32_t time_t;
#else
typedef __time64_t time_t;
#endif
#endif
windows库函数:dir: D:\Windows Kits\10\Include\10.0.17763.0\ucrt
,两种用法
typedef long __time32_t;
typedef __int64 __time64_t;
#ifndef _CRT_NO_TIME_T
#ifdef _USE_32BIT_TIME_T
typedef __time32_t time_t;
#else
typedef __time64_t time_t;
#endif
#endif
只要能处理它的差异我觉得就可以
直接#define _USE_64BIT_TIME_T
在windows就可以了
测试加一个sizeof
,看它是否为long
类型吧
in macos ci 👎 xmake config
error:
checkinfo: ...xmake/core/sandbox/modules/import/core/tool/compiler.lua:84: ./.xmake-cache/share/xmake/modules/core/tools/gcc.lua:805: /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/.xmake501/230909/_14FDEFC937DC4F8689A89B02F335D2B3.cpp:3:9: error: unknown type name 'time_t'
typedef time_t __type_time_t;
^
1 error generated.
ci: macos
replace HAVE_GETTIMEOFDAY -> /* #undef HAVE_GETTIMEOFDAY */
Ref: https://opensource.apple.com/source/xnu/xnu-792.24.17/bsd/i386/_types.h.auto.html
#if defined(__GNUC__) && defined(__WINT_TYPE__)
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
#else
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
#endif
typedef unsigned long __darwin_clock_t; /* clock() */
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
#endif /* _BSD_I386__TYPES_H_ */
in file <sys/timeb.h>
#include <sys/_types.h>
#include <sys/_types/_time_t.h>
in file <sys/_types/_time_t.h>
typedef __darwin_time_t time_t;
so we just need to make defined(__GNUC__) && defined(__WINT_TYPE__)
work.
可以一步一步来 HAVE_TIME_T 这个和别的,分成两个pr吧
这块可以继续给 mogan 做优化,mogan里面也有类似的问题
This PR is not complete yet; using CI for environment testing