-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathcaml_unix.ts
87 lines (70 loc) · 2.97 KB
/
caml_unix.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Js_of_ocaml runtime support
// http://www.ocsigen.org/js_of_ocaml/
// Copyright (C) 2014 Jérôme Vouillon, Hugo Heuzard, Andy Ray
// Laboratoire PPS - CNRS Université Paris Diderot
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, with linking exception;
// either version 2.1 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Copyright (c) 2015 Bloomberg LP. All rights reserved.
// Hongbo Zhang (hzhang295@bloomberg.net)
"use strict";
function unix_inet_addr_of_string () {return 0;}
export function caml_install_signal_handler(){return 0}
// Unix support
//Provides: unix_gettimeofday
function unix_gettimeofday () {
return (new Date()).getTime() / 1000;
}
//Provides: unix_time
//Requires: unix_gettimeofday
function unix_time () {
return Math.floor(unix_gettimeofday ());
}
//Provides: unix_gmtime
//function unix_gmtime (t) {
// var d = new Date (t * 1000);
// var januaryfirst = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
// var doy = Math.floor((d - januaryfirst) / 86400000);
// return [0, d.getUTCSeconds(), d.getUTCMinutes(), d.getUTCHours(),
// d.getUTCDate(), d.getUTCMonth(), d.getUTCFullYear() - 1900,
// d.getUTCDay(), doy,
// false | 0 /* for UTC daylight savings time is false */]
//}
//Provides: unix_localtime
//function unix_localtime (t) {
// var d = new Date (t * 1000);
// var januaryfirst = new Date(d.getFullYear(), 0, 1);
// var doy = Math.floor((d - januaryfirst) / 86400000);
// var jan = new Date(d.getFullYear(), 0, 1);
// var jul = new Date(d.getFullYear(), 6, 1);
// var stdTimezoneOffset = Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
// return [0, d.getSeconds(), d.getMinutes(), d.getHours(),
// d.getDate(), d.getMonth(), d.getFullYear() - 1900,
// d.getDay(), doy,
// (d.getTimezoneOffset() < stdTimezoneOffset) | 0 /* daylight savings time field. */]
//}
//Provides: unix_mktime
//Requires: unix_localtime
//function unix_mktime(tm){
// var d = new Date(tm[6]+1900,tm[5],tm[4],tm[3],tm[2],tm[1]);
// var t = Math.floor(d.getTime() / 1000);
// var tm2 = unix_localtime(t);
// return [0,t,tm2];
//}
//Provides: win_startup const
function win_startup() {}
//Provides: win_cleanup const
function win_cleanup() {}
//Provides: win_handle_fd const
function win_handle_fd(x) {return x;}