@@ -439,12 +439,12 @@ NAN_METHOD(CreateTimePoint) {
439439 return ;
440440 }
441441 v8::Local<v8::BigInt> bigInt = info[0 ].As <v8::BigInt>();
442- const int64_t total_nanoseconds = bigInt->Int64Value ();
442+ const int64_t nanoseconds = bigInt->Int64Value ();
443443 uint32_t clock_type = Nan::To<uint32_t >(info[1 ]).FromJust ();
444444 rcl_time_point_t * time_point =
445445 reinterpret_cast <rcl_time_point_t *>(malloc (sizeof (rcl_time_point_t )));
446446
447- time_point->nanoseconds = total_nanoseconds ;
447+ time_point->nanoseconds = nanoseconds ;
448448 time_point->clock_type = static_cast <rcl_clock_type_t >(clock_type);
449449
450450 auto js_obj =
@@ -468,10 +468,10 @@ NAN_METHOD(CreateDuration) {
468468 return ;
469469 }
470470 v8::Local<v8::BigInt> bigInt = info[0 ].As <v8::BigInt>();
471- const int64_t total_nanoseconds = bigInt->Int64Value ();
471+ const int64_t nanoseconds = bigInt->Int64Value ();
472472 rcl_duration_t * duration =
473473 reinterpret_cast <rcl_duration_t *>(malloc (sizeof (rcl_duration_t )));
474- duration->nanoseconds = total_nanoseconds ;
474+ duration->nanoseconds = nanoseconds ;
475475
476476 auto js_obj =
477477 RclHandle::NewInstance (duration, nullptr , [](void * ptr) { free (ptr); });
@@ -551,24 +551,6 @@ NAN_METHOD(CreateClock) {
551551 }));
552552}
553553
554- static void ReturnJSTimeObj (
555- Nan::NAN_METHOD_ARGS_TYPE info, int64_t nanoseconds,
556- rcl_clock_type_t clock_type = RCL_CLOCK_UNINITIALIZED) {
557- auto obj = v8::Object::New (v8::Isolate::GetCurrent ());
558- const auto sec = static_cast <std::int32_t >(RCL_NS_TO_S (nanoseconds));
559- const auto nanosec =
560- static_cast <std::int32_t >(nanoseconds % (1000 * 1000 * 1000 ));
561- const int32_t type = clock_type;
562-
563- Nan::Set (obj, Nan::New (" sec" ).ToLocalChecked (), Nan::New (sec));
564- Nan::Set (obj, Nan::New (" nanosec" ).ToLocalChecked (), Nan::New (nanosec));
565- if (clock_type != RCL_CLOCK_UNINITIALIZED) {
566- Nan::Set (obj, Nan::New (" type" ).ToLocalChecked (), Nan::New (type));
567- }
568-
569- info.GetReturnValue ().Set (obj);
570- }
571-
572554NAN_METHOD (ClockGetNow) {
573555 rcl_clock_t * clock = reinterpret_cast <rcl_clock_t *>(
574556 RclHandle::Unwrap<RclHandle>(
@@ -585,62 +567,6 @@ NAN_METHOD(ClockGetNow) {
585567 info.GetReturnValue ().Set (bigInt);
586568}
587569
588- NAN_METHOD (StaticClockGetNow) {
589- int32_t type = Nan::To<int32_t >(info[0 ]).FromJust ();
590-
591- if (type < RCL_ROS_TIME && type > RCL_STEADY_TIME) {
592- info.GetReturnValue ().Set (Nan::Undefined ());
593- return ;
594- }
595-
596- rcl_clock_t ros_clock;
597- rcl_time_point_t rcl_time;
598- rcl_allocator_t allocator = rcl_get_default_allocator ();
599-
600- THROW_ERROR_IF_NOT_EQUAL (RCL_RET_OK,
601- rcl_clock_init (static_cast <rcl_clock_type_t >(type),
602- &ros_clock, &allocator),
603- rcl_get_error_string ().str );
604-
605- THROW_ERROR_IF_NOT_EQUAL (RCL_RET_OK,
606- rcl_clock_get_now (&ros_clock, &rcl_time.nanoseconds ),
607- rcl_get_error_string ().str );
608-
609- THROW_ERROR_IF_NOT_EQUAL (RCL_RET_OK, rcl_clock_fini (&ros_clock),
610- rcl_get_error_string ().str );
611-
612- ReturnJSTimeObj (info, rcl_time.nanoseconds , rcl_time.clock_type );
613- }
614-
615- NAN_METHOD (TimeDiff) {
616- int64_t s_sec = Nan::To<int32_t >(info[0 ]).FromJust ();
617- uint32_t s_nano = Nan::To<uint32_t >(info[1 ]).FromJust ();
618- int32_t s_type = Nan::To<int32_t >(info[2 ]).FromJust ();
619-
620- int64_t f_sec = Nan::To<int32_t >(info[3 ]).FromJust ();
621- uint32_t f_nano = Nan::To<uint32_t >(info[4 ]).FromJust ();
622- int32_t f_type = Nan::To<int32_t >(info[5 ]).FromJust ();
623-
624- rcl_time_point_t start;
625- rcl_time_point_t finish;
626- rcl_duration_t delta;
627-
628- start.nanoseconds = s_sec * 1000 * 1000 * 1000 + s_nano;
629- start.clock_type = static_cast <rcl_clock_type_t >(s_type);
630-
631- finish.nanoseconds = f_sec * 1000 * 1000 * 1000 + f_nano;
632- finish.clock_type = static_cast <rcl_clock_type_t >(f_type);
633-
634- auto ret = rcl_difference_times (&start, &finish, &delta);
635-
636- if (ret == RCL_RET_OK) {
637- ReturnJSTimeObj (info, delta.nanoseconds );
638- return ;
639- }
640-
641- info.GetReturnValue ().Set (Nan::Undefined ());
642- }
643-
644570NAN_METHOD (RclTake) {
645571 RclHandle* subscription_handle = RclHandle::Unwrap<RclHandle>(
646572 Nan::To<v8::Object>(info[0 ]).ToLocalChecked ());
@@ -2063,8 +1989,6 @@ std::vector<BindingMethod> binding_methods = {
20631989 {" timerGetTimeUntilNextCall" , TimerGetTimeUntilNextCall},
20641990 {" createClock" , CreateClock},
20651991 {" clockGetNow" , ClockGetNow},
2066- {" staticClockGetNow" , StaticClockGetNow},
2067- {" timeDiff" , TimeDiff},
20681992 {" createTimePoint" , CreateTimePoint},
20691993 {" getNanoseconds" , GetNanoseconds},
20701994 {" createDuration" , CreateDuration},
0 commit comments