File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,6 +249,15 @@ void interactive(chaiscript::ChaiScript& chai)
249249 }
250250}
251251
252+ double getTimeInSeconds ()
253+ {
254+ using namespace std ::chrono;
255+ static time_point<high_resolution_clock> start = high_resolution_clock::now ();
256+
257+ duration<double > elapsed_seconds = high_resolution_clock::now () - start;
258+ return elapsed_seconds.count ();
259+ }
260+
252261int main (int argc, char *argv[])
253262{
254263
@@ -288,6 +297,8 @@ int main(int argc, char *argv[])
288297 chai.add (chaiscript::fun (&help), " help" );
289298 chai.add (chaiscript::fun (&throws_exception), " throws_exception" );
290299 chai.add (chaiscript::fun (&get_eval_error), " get_eval_error" );
300+ chai.add (chaiscript::fun (&getTimeInSeconds), " getTimeInSeconds" );
301+
291302
292303 for (int i = 0 ; i < argc; ++i) {
293304 if ( i == 0 && argc > 1 ) {
You can’t perform that action at this time.
0 commit comments