2 * libwebsockets - small server side websockets and web server implementation
4 * Copyright (C) 2010 - 2018 Andy Green <andy@warmcat.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation:
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
23 #define _WINSOCK_DEPRECATED_NO_WARNINGS
25 #include "core/private.h"
31 #ifndef DELTA_EPOCH_IN_MICROSECS
32 #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
35 ULARGE_INTEGER datetime;
38 GetCurrentFT(&filetime);
40 GetSystemTimeAsFileTime(&filetime);
44 * As per Windows documentation for FILETIME, copy the resulting
45 * FILETIME structure to a ULARGE_INTEGER structure using memcpy
46 * (using memcpy instead of direct assignment can prevent alignment
47 * faults on 64-bit Windows).
49 memcpy(&datetime, &filetime, sizeof(datetime));
51 /* Windows file times are in 100s of nanoseconds. */
52 return (datetime.QuadPart / 10) - DELTA_EPOCH_IN_MICROSECS;
57 time_t time(time_t *t)
59 time_t ret = lws_now_usecs() / 1000000;
69 lws_get_random(struct lws_context *context, void *buf, int len)
72 char *p = (char *)buf;
74 for (n = 0; n < len; n++)
75 p[n] = (unsigned char)rand();
82 lwsl_emit_syslog(int level, const char *line)
84 lwsl_emit_stderr(level, line);
88 int kill(int pid, int sig)
90 lwsl_err("Sorry Windows doesn't support kill().");
96 lwsl_err("Sorry Windows doesn't support fork().");
102 lws_plat_recommended_rsa_bits(void)