[gjs] jsapi-util: Remove gjs_date_from_time_t



commit 708701f00dd79b9c5fdac0b25a02ee05f5c65a76
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jan 15 15:50:47 2014 -0500

    jsapi-util: Remove gjs_date_from_time_t
    
    This is a slow wrapper for JS_NewDateObjectWithMsec

 gjs/jsapi-util.cpp |   29 -----------------------------
 gjs/jsapi-util.h   |    2 --
 2 files changed, 0 insertions(+), 31 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 7cd0d5d..e3bae67 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -768,35 +768,6 @@ gjs_get_type_name(jsval value)
     }
 }
 
-jsval
-gjs_date_from_time_t (JSContext *context, time_t time)
-{
-    JSObject *date;
-    JSObject *date_constructor;
-    jsval date_prototype;
-    jsval args[1];
-    jsval result;
-
-    JS_BeginRequest(context);
-
-    if (!JS_GetClassObject(context, JS_GetGlobalObject(context), JSProto_Date,
-                           &date_constructor))
-        g_error("Failed to lookup Date prototype");
-
-    if (!JS_GetProperty(context, date_constructor, "prototype", &date_prototype))
-        g_error("Failed to get prototype from Date constructor");
-
-    if (!JS_NewNumberValue(context, ((double) time) * 1000, &(args[0])))
-        g_error("Failed to convert time_t to number");
-
-    date = JS_New(context, JSVAL_TO_OBJECT (date_prototype), 1, args);
-
-    result = OBJECT_TO_JSVAL(date);
-    JS_EndRequest(context);
-
-    return result;
-}
-
 /**
  * gjs_value_to_int64:
  * @context: the Javascript context object
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 265ef24..f7cff11 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -343,8 +343,6 @@ JSBool      gjs_value_to_int64               (JSContext       *context,
                                               const jsval      val,
                                               gint64          *result);
 
-jsval       gjs_date_from_time_t             (JSContext *context, time_t time);
-
 JSBool      gjs_parse_args                   (JSContext  *context,
                                               const char *function_name,
                                               const char *format,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]