Index: /trunk/FACT++/src/InterpreterV8.cc
===================================================================
--- /trunk/FACT++/src/InterpreterV8.cc	(revision 15271)
+++ /trunk/FACT++/src/InterpreterV8.cc	(revision 15272)
@@ -6,4 +6,6 @@
 #include <sstream>
 #include <iomanip>
+
+#include <sys/stat.h>
 
 #include <boost/tokenizer.hpp>
@@ -1918,5 +1920,5 @@
             hrz = LN_SOLAR_NAUTIC_HORIZON;
         if (arg==string("fact").substr(0, arg.length()))
-            hrz = -15;
+            hrz = -13;
         if (arg==string("astronomical").substr(0, arg.length()))
             hrz = LN_SOLAR_ASTRONOMICAL_HORIZON;
@@ -2083,6 +2085,26 @@
         return Undefined();
 
-    //if (main && JsGetCurrentState().index!=3)
-    //    JsSetState(3);
+    const Handle<String> __date__ = String::New("__DATE__");
+    const Handle<String> __file__ = String::New("__FILE__");
+
+    Handle<Value> save_date;
+    Handle<Value> save_file;
+
+    Handle<Object> global = Context::GetCurrent()->Global();
+    if (!global.IsEmpty())
+    {
+        struct stat attrib;
+        if (stat(file.c_str(), &attrib)==0)
+        {
+            save_date = global->Get(__date__);
+            save_file = global->Get(__file__);
+
+            global->Set(__file__, String::New(file.c_str()));
+
+            const Local<Value> date = Date::New(attrib.st_mtime*1000);
+            if (!date.IsEmpty())
+                global->Set(__date__, date);
+        }
+    }
 
     const Handle<Value> rc = script->Run();
@@ -2094,4 +2116,10 @@
     if (!rc->IsUndefined() && file!="internal")
         JsResult(*String::AsciiValue(rc));
+
+    if (!global.IsEmpty() && !save_date.IsEmpty())
+    {
+        global->ForceSet(__date__, save_date);
+        global->ForceSet(__file__, save_file);
+    }
 
     return handle_scope.Close(rc);
@@ -2415,4 +2443,8 @@
     context->Global()->Set(String::New("arg"), args, ReadOnly);
 
+    const Local<Value> starttime = Date::New(Time().JavaDate());
+    if (!starttime.IsEmpty())
+        context->Global()->Set(String::New("__START__"), starttime, ReadOnly);
+
     //V8::ResumeProfiler();
 
