X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwin32%2Fwrappers.h;h=732e6a06f04f15e79a88da3f7809f5e074d9b982;hb=5ce822522487236bd04587e55920508bfcdbfdca;hp=5bf325e9b31f68d431d1d30aa27370a17417acc3;hpb=5e760300d15ef4c5b7eed3fb9f37920ebca2f6ec;p=awesomized%2Flibmemcached diff --git a/src/win32/wrappers.h b/src/win32/wrappers.h index 5bf325e9..732e6a06 100644 --- a/src/win32/wrappers.h +++ b/src/win32/wrappers.h @@ -59,6 +59,12 @@ #ifndef SHUT_RDWR # define SHUT_RDWR SD_BOTH #endif +#ifndef SHUT_WR +# define SHUT_WR SD_SEND +#endif +#ifndef SHUT_RD +# define SHUT_RD SD_RECEIVE +#endif /* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */ #ifndef EAI_SYSTEM @@ -75,3 +81,24 @@ #define waitpid(a,b,c) (-1) #define fnmatch(a,b,c) (-1) #define sleep(a) Sleep(a*1000) + +#ifdef __cplusplus +# include +static inline int gettimeofday(struct timeval* tp, struct timezone* tzp) { + using clock = std::chrono::system_clock; + auto as_sec = [] (auto d) { + return std::chrono::duration_cast(d); + }; + auto as_usec = [] (auto d) { + return std::chrono::duration_cast(d); + }; + + auto now = clock::now().time_since_epoch(); + auto sec = as_sec(now); + auto usec = as_usec(now - sec); + + tp->tv_sec = sec.count(); + tp->tv_usec = usec.count(); + return 0; +} +#endif