on master help sign in
Fix 'time' to return Integer rather than Int
dc27739Edwin Brady
libs/base/System.idr+3−2
@@ -73,8 +73,9 @@ exit : Int -> IO ()
73exit code = foreign FFI_C "exit" (Int -> IO ()) code
73exit code = foreign FFI_C "exit" (Int -> IO ()) code
74
74
75||| Get the Unix time
75||| Get the Unix time
76−time : IO Int
76+time : IO Integer
77−time = foreign FFI_C "idris_time" (IO Int)
77+time = do MkRaw t <- foreign FFI_C "idris_time" (IO (Raw Integer))
78+ return t
78
79
79usleep : Int -> IO ()
80usleep : Int -> IO ()
80usleep i = foreign FFI_C "usleep" (Int -> IO ()) i
81usleep i = foreign FFI_C "usleep" (Int -> IO ()) i
libs/effects/Effect/System.idr+2−2
@@ -9,7 +9,7 @@ import Control.IOExcept
9
9
10data System : Effect where
10data System : Effect where
11 Args : sig System (List String)
11 Args : sig System (List String)
12− Time : sig System Int
12+ Time : sig System Integer
13 GetEnv : String -> sig System (Maybe String)
13 GetEnv : String -> sig System (Maybe String)
14 CSystem : String -> sig System Int
14 CSystem : String -> sig System Int
15
15
@@ -33,7 +33,7 @@ SYSTEM = MkEff () System
33getArgs : Eff (List String) [SYSTEM]
33getArgs : Eff (List String) [SYSTEM]
34getArgs = call Args
34getArgs = call Args
35
35
36−time : Eff Int [SYSTEM]
36+time : Eff Integer [SYSTEM]
37time = call Time
37time = call Time
38
38
39getEnv : String -> Eff (Maybe String) [SYSTEM]
39getEnv : String -> Eff (Maybe String) [SYSTEM]
rts/idris_stdfgn.c+3−2
@@ -1,5 +1,6 @@
1#include "idris_stdfgn.h"
1#include "idris_stdfgn.h"
2#include "idris_rts.h"
2#include "idris_rts.h"
3+#include "idris_gmp.h"
3#include "idris_gc.h"
4#include "idris_gc.h"
4#include <sys/select.h>
5#include <sys/select.h>
5#include <fcntl.h>
6#include <fcntl.h>
@@ -80,9 +81,9 @@ char* getEnvPair(int i) {
80 return *(environ + i);
81 return *(environ + i);
81}
82}
82
83
83−int idris_time() {
84+VAL idris_time() {
84 time_t t = time(NULL);
85 time_t t = time(NULL);
85− return (int)t;
86+ return MKBIGI(t);
86}
87}
87
88
88void idris_forceGC(void* vm) {
89void idris_forceGC(void* vm) {
rts/idris_stdfgn.h+3−1
@@ -1,6 +1,8 @@
1#ifndef _IDRISSTDFGN_H
1#ifndef _IDRISSTDFGN_H
2#define _IDRISSTDFGN_H
2#define _IDRISSTDFGN_H
3
3
4+#include "idris_rts.h"
5+
4// A collection of useful standard functions to be used by the prelude.
6// A collection of useful standard functions to be used by the prelude.
5
7
6void putStr(char* str);
8void putStr(char* str);
@@ -22,7 +24,7 @@ void* idris_stdin();
22
24
23char* getEnvPair(int i);
25char* getEnvPair(int i);
24
26
25−int idris_time();
27+VAL idris_time();
26
28
27void idris_forceGC();
29void idris_forceGC();
28
30