summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/ecall.txt21
-rw-r--r--rvcontroller.lua30
2 files changed, 51 insertions, 0 deletions
diff --git a/doc/ecall.txt b/doc/ecall.txt
index 02cdcab..9bfd553 100644
--- a/doc/ecall.txt
+++ b/doc/ecall.txt
@@ -72,4 +72,25 @@ a1 - Size of the buffer that the channel string will be written into
a2 - Address that the message will be written to
a3 - Size of the buffer that the message will be written into
+a7(/15) = 136
+Returns a value in a0 containing (some aspect of) the current date and/or time.
+The meaning of the returned value depends on the value of a0:
+* 0 = Unix timestamp (low 32 bits)
+* 1 = Unix timestamp (high 32 bits - this will be all zeroes until some time in 2106)
+* 2 = Year
+* 3 = Month
+* 4 = Day
+* 5 = Hour
+* 6 = Minute
+* 7 = Second
+
+a7(/a5) = 137
+Atomically reads the full time/date and returns values in a0-a5 as follows:
+* a0 - Year
+* a1 - Month
+* a2 - Day
+* a3 - Hour
+* a4 - Minute
+* a5 - Second
+
All values not listed are reserved.
diff --git a/rvcontroller.lua b/rvcontroller.lua
index 8319b5c..937727f 100644
--- a/rvcontroller.lua
+++ b/rvcontroller.lua
@@ -1387,6 +1387,36 @@ local operations = {
writeram(address,string.byte(string.sub(dlevent.msg,i,i)),1)
end
table.remove(mem.digilinesqueue,1)
+ elseif func == 136 then
+ --a7=136 - Get Current Time
+ local datetable = os.datetable()
+ local a0 = getreg(10)
+ if a0 == 0 then
+ setreg(10,os.time()%2^32)
+ elseif a0 == 1 then
+ setreg(10,math.floor(os.time()/2^32))
+ elseif a0 == 2 then
+ setreg(10,datetable.year)
+ elseif a0 == 3 then
+ setreg(10,datetable.month)
+ elseif a0 == 4 then
+ setreg(10,datetable.day)
+ elseif a0 == 5 then
+ setreg(10,datetable.hour)
+ elseif a0 == 6 then
+ setreg(10,datetable.min)
+ elseif a0 == 7 then
+ setreg(10,datetable.sec)
+ end
+ elseif func == 137 then
+ --a7=137 - Get Full Date Table
+ local datetable = os.datetable()
+ setreg(10,datetable.year)
+ setreg(11,datetable.month)
+ setreg(12,datetable.day)
+ setreg(13,datetable.hour)
+ setreg(14,datetable.min)
+ setreg(15,datetable.sec)
end
end,
ebreak = function()