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

Added 'uptime' member to JS System object.

parent c8a8180f
No related branches found
No related tags found
No related merge requests found
...@@ -722,7 +722,8 @@ static JSClass js_node_class = { ...@@ -722,7 +722,8 @@ static JSClass js_node_class = {
extern const char* beta_version; extern const char* beta_version;
JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent, scfg_t* cfg) JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent
,scfg_t* cfg, time_t uptime)
{ {
char str[256]; char str[256];
uint i; uint i;
...@@ -802,6 +803,10 @@ JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent, scfg_t* ...@@ -802,6 +803,10 @@ JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent, scfg_t*
/***********************/ /***********************/
val = INT_TO_JSVAL(uptime);
if(!JS_SetProperty(cx, sysobj, "uptime", &val))
return(NULL);
if(!JS_DefineProperties(cx, sysobj, js_system_properties)) if(!JS_DefineProperties(cx, sysobj, js_system_properties))
return(NULL); return(NULL);
......
...@@ -82,6 +82,7 @@ static bool scfg_reloaded=true; ...@@ -82,6 +82,7 @@ static bool scfg_reloaded=true;
static char * text[TOTAL_TEXT]; static char * text[TOTAL_TEXT];
static WORD first_node; static WORD first_node;
static WORD last_node; static WORD last_node;
static time_t uptime;
#ifdef JAVASCRIPT #ifdef JAVASCRIPT
JSRuntime* js_runtime=NULL; JSRuntime* js_runtime=NULL;
...@@ -314,7 +315,7 @@ bool sbbs_t::js_initcx() ...@@ -314,7 +315,7 @@ bool sbbs_t::js_initcx()
break; break;
/* System Object */ /* System Object */
if(js_CreateSystemObject(js_cx, js_glob, &cfg)==NULL) if(js_CreateSystemObject(js_cx, js_glob, &cfg, uptime)==NULL)
break; break;
/* Client Object */ /* Client Object */
...@@ -2971,6 +2972,8 @@ void DLLCALL bbs_thread(void* arg) ...@@ -2971,6 +2972,8 @@ void DLLCALL bbs_thread(void* arg)
thread_up(); thread_up();
uptime=time(NULL);
status("Initializing"); status("Initializing");
/* Defeat the lameo hex0rs - the name and copyright must remain intact */ /* Defeat the lameo hex0rs - the name and copyright must remain intact */
......
...@@ -791,7 +791,8 @@ extern "C" { ...@@ -791,7 +791,8 @@ extern "C" {
DLLEXPORT JSObject* DLLCALL js_CreateGlobalObject(JSContext* cx, scfg_t* cfg); DLLEXPORT JSObject* DLLCALL js_CreateGlobalObject(JSContext* cx, scfg_t* cfg);
/* js_system.c */ /* js_system.c */
DLLEXPORT JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent, scfg_t* cfg); DLLEXPORT JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent
,scfg_t* cfg, time_t uptime);
/* js_client.c */ /* js_client.c */
DLLEXPORT JSObject* DLLCALL js_CreateClientObject(JSContext* cx, JSObject* parent DLLEXPORT JSObject* DLLCALL js_CreateClientObject(JSContext* cx, JSObject* parent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment