reorganization and project rename
This commit is contained in:
parent
35b0a4f6dd
commit
def41120c1
20 changed files with 42 additions and 39 deletions
34
lib/kestrel_varvara/Datetime.ml
Normal file
34
lib/kestrel_varvara/Datetime.ml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
module Make () : Kestrel.Device.DEVICE with type state = unit = struct
|
||||
type state = unit
|
||||
|
||||
let state = ()
|
||||
|
||||
let dei_ports =
|
||||
Kestrel.Device.Int_set.of_list
|
||||
[ 0xc0; 0xc2; 0xc3; 0xc4; 0xc5; 0xc6; 0xc7; 0xc8; 0xca ]
|
||||
|
||||
let deo_ports = Kestrel.Device.Int_set.empty
|
||||
|
||||
let dei _ port =
|
||||
let now = Unix.time () in
|
||||
let tm = Unix.localtime now in
|
||||
match port with
|
||||
| 0xc2 -> tm.Unix.tm_mon
|
||||
| 0xc3 -> tm.Unix.tm_mday
|
||||
| 0xc4 -> tm.Unix.tm_hour
|
||||
| 0xc5 -> tm.Unix.tm_min
|
||||
| 0xc6 -> tm.Unix.tm_sec
|
||||
| 0xc7 -> tm.Unix.tm_wday
|
||||
| 0xca -> Bool.to_int tm.Unix.tm_isdst
|
||||
| _ -> assert false
|
||||
|
||||
let dei2 _ port =
|
||||
let now = Unix.time () in
|
||||
let tm = Unix.localtime now in
|
||||
match port with
|
||||
| 0xc0 -> tm.Unix.tm_year + 1900
|
||||
| 0xc8 -> tm.Unix.tm_yday
|
||||
| _ -> assert false
|
||||
|
||||
let deo _ _ _ = assert false
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue