]> git.sesse.net Git - mlt/blob - src/win32/win32.c
Implement LC_NUMERIC handling for non-glibc and non-Darwin OS.
[mlt] / src / win32 / win32.c
1
2 #include <errno.h> 
3 #include <time.h> 
4 #include <windows.h>
5 #include <pthread.h>
6
7 int usleep(unsigned int useconds)
8 {
9         HANDLE timer;
10         LARGE_INTEGER due;
11
12         due.QuadPart = -(10 * (__int64)useconds);
13
14         timer = CreateWaitableTimer(NULL, TRUE, NULL);
15         SetWaitableTimer(timer, &due, 0, NULL, NULL, 0);
16         WaitForSingleObject(timer, INFINITE);
17         CloseHandle(timer);
18         return 0;
19 }
20
21
22 int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
23 {
24         if (rqtp->tv_nsec > 999999999) {
25                 /* The time interval specified 1,000,000 or more microseconds. */
26                 errno = EINVAL;
27                 return -1;
28         }
29         return usleep( rqtp->tv_sec * 1000000 + rqtp->tv_nsec / 1000 );
30
31
32 int setenv(const char *name, const char *value, int overwrite)
33 {
34         int result = 1; 
35         if (overwrite == 0 && getenv (name))  {
36                 result = 0;
37         } else  {
38                 result = SetEnvironmentVariable (name,value); 
39          }
40
41         return result; 
42
43