Skip to content
Snippets Groups Projects
Commit fa04e7b0 authored by rswindell's avatar rswindell
Browse files

Expose xp_timer() value as system.timer.

parent b3bcd103
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,7 @@ enum { ...@@ -100,6 +100,7 @@ enum {
/* msclock() access */ /* msclock() access */
,SYS_PROP_CLOCK ,SYS_PROP_CLOCK
,SYS_PROP_CLOCK_PER_SEC ,SYS_PROP_CLOCK_PER_SEC
,SYS_PROP_TIMER
/* filenames */ /* filenames */
,SYS_PROP_DEVNULL ,SYS_PROP_DEVNULL
...@@ -291,6 +292,9 @@ static JSBool js_system_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp) ...@@ -291,6 +292,9 @@ static JSBool js_system_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
case SYS_PROP_CLOCK_PER_SEC: case SYS_PROP_CLOCK_PER_SEC:
JS_NewNumberValue(cx,MSCLOCKS_PER_SEC,vp); JS_NewNumberValue(cx,MSCLOCKS_PER_SEC,vp);
break; break;
case SYS_PROP_TIMER:
JS_NewNumberValue(cx,xp_timer(),vp);
break;
case SYS_PROP_LOCAL_HOSTNAME: case SYS_PROP_LOCAL_HOSTNAME:
gethostname(str,sizeof(str)); gethostname(str,sizeof(str));
...@@ -396,6 +400,7 @@ static jsSyncPropertySpec js_system_properties[] = { ...@@ -396,6 +400,7 @@ static jsSyncPropertySpec js_system_properties[] = {
/* clock access */ /* clock access */
{ "clock_ticks", SYS_PROP_CLOCK ,SYSOBJ_FLAGS, 311 }, { "clock_ticks", SYS_PROP_CLOCK ,SYSOBJ_FLAGS, 311 },
{ "clock_ticks_per_second", SYS_PROP_CLOCK_PER_SEC ,SYSOBJ_FLAGS, 311 }, { "clock_ticks_per_second", SYS_PROP_CLOCK_PER_SEC ,SYSOBJ_FLAGS, 311 },
{ "timer", SYS_PROP_TIMER ,SYSOBJ_FLAGS, 313 },
/* last */ /* last */
{ "local_host_name", SYS_PROP_LOCAL_HOSTNAME ,SYSOBJ_FLAGS, 311 }, { "local_host_name", SYS_PROP_LOCAL_HOSTNAME ,SYSOBJ_FLAGS, 311 },
...@@ -467,6 +472,7 @@ static char* sys_prop_desc[] = { ...@@ -467,6 +472,7 @@ static char* sys_prop_desc[] = {
/* clock */ /* clock */
,"amount of elapsed processor time in clock 'ticks'" ,"amount of elapsed processor time in clock 'ticks'"
,"number of clock ticks per second" ,"number of clock ticks per second"
,"high-resolution timer, in seconds (fractional seconds supported)"
/* INSERT new tabled properties here */ /* INSERT new tabled properties here */
,"private host name that uniquely identifies this system on the local network" ,"private host name that uniquely identifies this system on the local network"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment