Author: metze
Date: 2005-10-15 10:04:33 +0000 (Sat, 15 Oct 2005)
New Revision: 11086

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

Log:
add sys.unix2nttime() function

metze
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-10-15 
09:32:04 UTC (rev 11085)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_sys.c      2005-10-15 
10:04:33 UTC (rev 11086)
@@ -67,6 +67,22 @@
 }
 
 /*
+  return time as a 64 bit nttime value from a 32 bit time_t value
+*/
+static int ejs_sys_unix2nttime(MprVarHandle eid, int argc, struct MprVar 
**argv)
+{
+       NTTIME nt;
+       if (argc != 1 || !mprVarIsNumber(argv[0]->type)) {
+               ejsSetErrorMsg(eid, "sys_unix2nttime invalid arguments");
+               return -1;
+       }
+       unix_to_nt_time(&nt, mprVarToNumber(argv[0]));
+       struct MprVar v = mprCreateNumberVar(nt);
+       mpr_Return(eid, v);
+       return 0;
+}
+
+/*
   return the given time as a gmtime structure
 */
 static int ejs_sys_gmtime(MprVarHandle eid, int argc, struct MprVar **argv)
@@ -313,6 +329,7 @@
        mprSetCFunction(obj, "interfaces", ejs_sys_interfaces);
        mprSetCFunction(obj, "hostname", ejs_sys_hostname);
        mprSetCFunction(obj, "nttime", ejs_sys_nttime);
+       mprSetCFunction(obj, "unix2nttime", ejs_sys_unix2nttime);
        mprSetCFunction(obj, "gmtime", ejs_sys_gmtime);
        mprSetCFunction(obj, "ldaptime", ejs_sys_ldaptime);
        mprSetCFunction(obj, "httptime", ejs_sys_httptime);

Reply via email to