Skip to content

Commit 5d11a1f

Browse files
committed
Round days since 2000 to 6 decimal places
1 parent fabdcad commit 5d11a1f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/blocks/sensingblocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ unsigned int SensingBlocks::daysSince2000(VirtualMachine *vm)
916916
clock = Clock::instance().get();
917917

918918
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(clock->currentSystemTime().time_since_epoch()).count();
919-
vm->addReturnValue(ms / 86400000.0 - 10957);
919+
vm->addReturnValue(std::round((ms / 86400000.0 - 10957) * 1000000.0) / 1000000.0);
920920

921921
return 0;
922922
}

test/blocks/sensing_blocks_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,5 +1928,5 @@ TEST_F(SensingBlocksTest, DaysSince2000Impl)
19281928
SensingBlocks::clock = nullptr;
19291929

19301930
ASSERT_EQ(vm.registerCount(), 1);
1931-
ASSERT_EQ(vm.getInput(0, 1)->toDouble(), 747.20278428240817);
1931+
ASSERT_EQ(vm.getInput(0, 1)->toDouble(), 747.202784);
19321932
}

0 commit comments

Comments
 (0)