浏览代码

Linux Kernel.Time: clock -> clock_gettime

Alexander Shiryaev 11 年之前
父节点
当前提交
8898153320
共有 6 个文件被更改,包括 31 次插入0 次删除
  1. 4 0
      BlackBox/_FreeBSDLinuxOpenBSD_Interp/build
  2. 26 0
      BlackBox/_Linux_/Lin/Mod/Rt.txt
  3. 二进制
      BlackBox/_Linux_/System/Mod/Kernel.odc
  4. 二进制
      BlackBox/_Linux_/libBB.so
  5. 二进制
      BlackBox/_Linux_/libBB0.so
  6. 1 0
      README

+ 4 - 0
BlackBox/_FreeBSDLinuxOpenBSD_Interp/build

@@ -4,6 +4,10 @@
 ConsCompiler.Compile('Lin/Mod', 'Dl.txt')
 ConsCompiler.Compile('Lin/Mod', 'Libc.txt')
 ConsCompiler.Compile('Lin/Mod', 'Iconv.txt')
+
+# Linux only
+ConsCompiler.Compile('Lin/Mod', 'Rt.txt')
+
 DevCompiler.CompileThis Kernel
 
 DevCompiler.CompileThis Files Console Math Strings Meta Dialog

+ 26 - 0
BlackBox/_Linux_/Lin/Mod/Rt.txt

@@ -0,0 +1,26 @@
+MODULE LinRt ["librt.so.1"];
+
+	(*
+		A. V. Shiryaev, 2013.12
+
+		GNU/Linux
+		32-bit
+	*)
+
+	CONST
+		CLOCK_REALTIME* = 0;
+		CLOCK_MONOTONIC* = 1;
+	
+	TYPE
+		time_t* = INTEGER;
+
+		timespec_t* = RECORD [untagged]
+			tv_sec*: time_t; (* seconds *)
+			tv_nsec*: INTEGER (* nanoseconds *)
+		END;
+
+		clockid_t* = INTEGER;
+
+	PROCEDURE [ccall] clock_gettime* (clock_id: clockid_t; VAR tp: timespec_t): INTEGER;
+
+END LinRt.

二进制
BlackBox/_Linux_/System/Mod/Kernel.odc


二进制
BlackBox/_Linux_/libBB.so


二进制
BlackBox/_Linux_/libBB0.so


+ 1 - 0
README

@@ -153,6 +153,7 @@ Files:
 		_LinuxOpenBSD_/Comm/Mod/V24.odc: CommV24 implementation for Linux and OpenBSD
 		_OpenBSD_/Comm/Mod/TCP.odc: CommTCP implementation for OpenBSD
 		_Linux_/Comm/Mod/TCP.odc: CommTCP implementation for Linux
+		_Linux_/Lin/Mod/Rt.odc: interface to librt
 
 		{_OpenBSD_,_Linux_}/libBB.so: compiled and linked shared library to run BlackBox
 		{_OpenBSD_,_Linux_}/libBB0.so: compiled, linked and packed shared library to run console interpreter