svn commit: samba r8582 - in branches/SAMBA_4_0/source/scripting/ejs: .

tridge at samba.org tridge at samba.org
Tue Jul 19 06:07:34 GMT 2005


Author: tridge
Date: 2005-07-19 06:07:34 +0000 (Tue, 19 Jul 2005)
New Revision: 8582

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8582

Log:
added sys.httptime() call, to display a NTTIME as a http time string



Modified:
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c	2005-07-19 06:07:10 UTC (rev 8581)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c	2005-07-19 06:07:34 UTC (rev 8582)
@@ -118,6 +118,24 @@
 }
 
 /*
+  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 @@
 	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);



More information about the samba-cvs mailing list