diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-10-15 10:04:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:44:46 -0500 |
commit | dab2b6858315909cd26fa5ce5aba84b6b4c3e62e (patch) | |
tree | 3dc49a8a7cd57b0331085ee4e73e08090506f0f6 /source4/scripting/ejs | |
parent | a8504e1061d248a54be93716ead545b2f066f2cf (diff) | |
download | samba-dab2b6858315909cd26fa5ce5aba84b6b4c3e62e.tar.gz samba-dab2b6858315909cd26fa5ce5aba84b6b4c3e62e.tar.bz2 samba-dab2b6858315909cd26fa5ce5aba84b6b4c3e62e.zip |
r11086: add sys.unix2nttime() function
metze
(This used to be commit a3abf10d431f82b12b0795d5bc217c8ec3ce89f7)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r-- | source4/scripting/ejs/smbcalls_sys.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_sys.c b/source4/scripting/ejs/smbcalls_sys.c index 5f6a756f8f..c4ad668112 100644 --- a/source4/scripting/ejs/smbcalls_sys.c +++ b/source4/scripting/ejs/smbcalls_sys.c @@ -67,6 +67,22 @@ static int ejs_sys_nttime(MprVarHandle eid, int argc, struct MprVar **argv) } /* + 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 @@ static int ejs_sys_init(MprVarHandle eid, int argc, struct MprVar **argv) 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); |