Added SILC Server library.
[silc.git] / lib / silcutil / os2 / silcos2util.c
1 /*
2
3   silcos2util.c 
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2002 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19 /* $Id$ */
20
21 #include "silc.h"
22
23 char *silc_string_regexify(const char *string)
24 {
25   return strdup(string);
26 }
27
28 char *silc_string_regex_combine(const char *string1, const char *string2)
29 {
30   return strdup(string1);
31 }
32
33 int silc_string_regex_match(const char *regex, const char *string)
34 {
35   return TRUE;
36 }
37
38 int silc_string_match(const char *string1, const char *string2)
39 {
40   return TRUE;
41 }
42
43 #define FILETIME_1970 0x019db1ded53e8000
44 const BYTE DWLEN = sizeof(DWORD) * 8;
45
46 /* Return current time in struct timeval. Code ripped from some xntp
47    implementation on http://src.openresources.com. */
48
49 int silc_gettimeofday(struct timeval *tv)
50 {
51   FILETIME ft;
52   __SilcInt64 msec;
53   
54   GetSystemTimeAsFileTime(&ft);
55   msec = (__SilcInt64) ft.dwHighDateTime << DWLEN | ft.dwLowDateTime;
56   msec = (msec - FILETIME_1970) / 10;
57   tv->tv_sec  = (long) (msec / 1000000);
58   tv->tv_usec = (long) (msec % 1000000);
59
60   return 0;
61 }