summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-19 06:07:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:41 -0500
commitafe0fffc443861f39a9aca9bd1cb0ed73d4fc994 (patch)
tree63f27e47a556d96c7d3861d28445a6dbae642bcc /source4/scripting
parent6615b40601fbb0d7c697d721907057d01995eb5a (diff)
downloadsamba-afe0fffc443861f39a9aca9bd1cb0ed73d4fc994.tar.gz
samba-afe0fffc443861f39a9aca9bd1cb0ed73d4fc994.tar.bz2
samba-afe0fffc443861f39a9aca9bd1cb0ed73d4fc994.zip
r8582: added sys.httptime() call, to display a NTTIME as a http time string
(This used to be commit 632f7bbe3e81af1ee89301765f8bfb72d4c9f3d7)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/smbcalls_sys.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c
index af51c815dc..b1fb854dfb 100644
--- a/source4/scripting/ejs/smbcalls_sys.c
+++ b/source4/scripting/ejs/smbcalls_sys.c
@@ -118,6 +118,24 @@ static int ejs_sys_ldaptime(MprVarHandle eid, int argc, struct MprVar **argv)
}
/*
+ return a http time string from a nttime
+*/
+static int ejs_sys_httptime(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ char *s;
+ time_t t;
+ if (argc != 1 || !mprVarIsNumber(argv[0]->type)) {
+ ejsSetErrorMsg(eid, "sys_httptime invalid arguments");
+ return -1;
+ }
+ t = nt_time_to_unix(mprVarToNumber(argv[0]));
+ s = http_timestring(mprMemCtx(), t);
+ mpr_Return(eid, mprString(s));
+ talloc_free(s);
+ return 0;
+}
+
+/*
unlink a file
ok = unlink(fname);
*/
@@ -182,6 +200,7 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetCFunction(&obj, "nttime", ejs_sys_nttime);
mprSetCFunction(&obj, "gmtime", ejs_sys_gmtime);
mprSetCFunction(&obj, "ldaptime", ejs_sys_ldaptime);
+ mprSetCFunction(&obj, "httptime", ejs_sys_httptime);
mprSetStringCFunction(&obj, "unlink", ejs_sys_unlink);
mprSetStringCFunction(&obj, "file_load", ejs_sys_file_load);
mprSetStringCFunction(&obj, "file_save", ejs_sys_file_save);