| 516 | } |
| 517 | |
| 518 | static tsn_value tsn_read_file(tsn_vm* ctx, tsn_value_const /*this_val*/, int argc, tsn_value_const* argv) { |
| 519 | const char* filename; |
| 520 | filename = JS_ToCString(ctx, argv[0]); |
| 521 | std::ifstream f(filename); |
| 522 | std::string str((istreambuf_iterator<char>(f)), istreambuf_iterator<char>()); |
| 523 | JS_FreeCString(ctx, filename); |
| 524 | return JS_NewStringLen(ctx, str.data(), str.size()); |
| 525 | ; |
| 526 | } |
| 527 | |
| 528 | static tsn_value tsn_now(tsn_vm* ctx, tsn_value_const /*this_val*/, int argc, tsn_value_const* argv) { |
| 529 | auto nano_since_epoch = std::chrono::high_resolution_clock::now().time_since_epoch() / std::chrono::nanoseconds(1); |
nothing calls this directly
no test coverage detected