123456789101112131415161718192021222324252627282930313233343536 |
- shell=util.shell
- function get_utc()
- local get_cmd="initc clock.utc"
- return shell(get_cmd)
- end
- function run()
- if request and request.data then
- req=json.decode(request.data)
- if req.method == "get" then
- ret.data=get_utc()
- end
- if req.method == "post" then
- if req.utc_status then
- local set_cmd='initc clock.utc %s'
- shell(set_cmd:format(req.utc_status))
- ret.status="OK"
- end
- ret.data=get_utc()
- end
- else
- ret.api={
- info="Tarih/Saat UTC Bilgisi",
- auth=false,
- method={
- get={},
- post={
- utc_status="utc_bilgisi",
- }
- },
- }
- end
- response=json.encode(ret)
- end
|