summary refs log tree commit diff stats
path: root/tinyc/win32/include/sys/timeb.h
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-11-02 10:46:30 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-11-02 10:46:30 +0100
commit1eaeccc15d15d15d2f62ea1648f7dd64722dbd37 (patch)
treeb922cdabc780fa3a8837a6804d2df31793d9e2ca /tinyc/win32/include/sys/timeb.h
parente9243a16167b24899d4fcf051f3252b3a5804811 (diff)
parentbd19b5f4d36bb40b4af93d7e15fdfa582e9fe3b7 (diff)
downloadNim-1eaeccc15d15d15d2f62ea1648f7dd64722dbd37.tar.gz
Merge branch 'devel' into araq
Diffstat (limited to 'tinyc/win32/include/sys/timeb.h')
-rw-r--r--tinyc/win32/include/sys/timeb.h177
1 files changed, 114 insertions, 63 deletions
diff --git a/tinyc/win32/include/sys/timeb.h b/tinyc/win32/include/sys/timeb.h
index b5bb0fc3d..34837738b 100644
--- a/tinyc/win32/include/sys/timeb.h
+++ b/tinyc/win32/include/sys/timeb.h
@@ -1,82 +1,133 @@
-/*
- * timeb.h
- *
- * Support for the UNIX System V ftime system call.
- *
- * This file is part of the Mingw32 package.
- *
- * Contributors:
- *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- *
- *  THIS SOFTWARE IS NOT COPYRIGHTED
- *
- *  This source code is offered for use in the public domain. You may
- *  use, modify or distribute it freely.
- *
- *  This code is distributed in the hope that it will be useful but
- *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
- *  DISCLAIMED. This includes but is not limited to warranties of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Revision: 1.2 $
- * $Author: bellard $
- * $Date: 2005/04/17 13:14:29 $
- *
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
  */
+#ifndef _TIMEB_H_
+#define _TIMEB_H_
 
-#ifndef	__STRICT_ANSI__
+#include <_mingw.h>
 
-#ifndef	_TIMEB_H_
-#define	_TIMEB_H_
+#ifndef _WIN32
+#error Only Win32 target is supported!
+#endif
 
-/* All the headers include this file. */
-#include <_mingw.h>
+#pragma pack(push,_CRT_PACKING)
 
-#ifndef	RC_INVOKED
+#ifdef __cplusplus
+extern "C" {
+#endif
 
-/*
- * TODO: Structure not tested.
- */
-struct _timeb
-{
-	long	time;
-	short	millitm;
-	short	timezone;
-	short	dstflag;
-};
+#ifndef _CRTIMP
+#define _CRTIMP __declspec(dllimport)
+#endif
 
-#ifndef	_NO_OLDNAMES
-/*
- * TODO: Structure not tested.
- */
-struct timeb
-{
-	long	time;
-	short	millitm;
-	short	timezone;
-	short	dstflag;
-};
+#ifndef __TINYC__ /* gr */
+#ifdef _USE_32BIT_TIME_T
+#ifdef _WIN64
+#undef _USE_32BIT_TIME_T
+#endif
+#else
+#if _INTEGRAL_MAX_BITS < 64
+#define _USE_32BIT_TIME_T
+#endif
+#endif
 #endif
 
+#ifndef _TIME32_T_DEFINED
+  typedef long __time32_t;
+#define _TIME32_T_DEFINED
+#endif
 
-#ifdef	__cplusplus
-extern "C" {
+#ifndef _TIME64_T_DEFINED
+#if _INTEGRAL_MAX_BITS >= 64
+  typedef __int64 __time64_t;
+#endif
+#define _TIME64_T_DEFINED
 #endif
 
-/* TODO: Not tested. */
-void	_ftime (struct _timeb*);
+#ifndef _TIME_T_DEFINED
+#ifdef _USE_32BIT_TIME_T
+  typedef __time32_t time_t;
+#else
+  typedef __time64_t time_t;
+#endif
+#define _TIME_T_DEFINED
+#endif
 
-#ifndef	_NO_OLDNAMES
-void	ftime (struct timeb*);
-#endif	/* Not _NO_OLDNAMES */
+#ifndef _TIMEB_DEFINED
+#define _TIMEB_DEFINED
 
-#ifdef	__cplusplus
-}
+  struct __timeb32 {
+    __time32_t time;
+    unsigned short millitm;
+    short timezone;
+    short dstflag;
+  };
+
+#ifndef	NO_OLDNAMES
+  struct timeb {
+    time_t time;
+    unsigned short millitm;
+    short timezone;
+    short dstflag;
+  };
 #endif
 
-#endif	/* Not RC_INVOKED */
+#if _INTEGRAL_MAX_BITS >= 64
+  struct __timeb64 {
+    __time64_t time;
+    unsigned short millitm;
+    short timezone;
+    short dstflag;
+  };
+#endif
+
+#ifdef _USE_32BIT_TIME_T
+#define _timeb __timeb32
+//gr #define _ftime _ftime32
+#define _ftime32 _ftime
+#else
+#define _timeb __timeb64
+#define _ftime _ftime64
+#endif
+#endif
+
+  _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time);
+#if _INTEGRAL_MAX_BITS >= 64
+  _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time);
+#endif
 
-#endif	/* Not _TIMEB_H_ */
+#ifndef _TIMESPEC_DEFINED
+#define _TIMESPEC_DEFINED
+struct timespec {
+  time_t  tv_sec;   /* Seconds */
+  long    tv_nsec;  /* Nanoseconds */
+};
 
-#endif	/* Not __STRICT_ANSI__ */
+struct itimerspec {
+  struct timespec  it_interval;  /* Timer period */
+  struct timespec  it_value;     /* Timer expiration */
+};
+#endif
 
+#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
+#ifdef _USE_32BIT_TIME_T
+__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
+  _ftime32((struct __timeb32 *)_Tmb);
+}
+#else
+__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) {
+  _ftime64((struct __timeb64 *)_Tmb);
+}
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#pragma pack(pop)
+
+#include <sec_api/sys/timeb_s.h>
+#endif