Skip to content
Snippets Groups Projects
Commit d2e25250 authored by Carmelo Pellegrino's avatar Carmelo Pellegrino
Browse files

Merge branch '8-bug-start-run-time-not-properly-computed' into 'master'

run start time corrected

Closes #8

See merge request tridas/tridas-core!5
parents 19641c07 23c22012
No related branches found
No related tags found
No related merge requests found
......@@ -71,6 +71,8 @@ target_link_libraries(
${Boost_LIBRARIES}
)
add_test(test_log t_log)
add_executable(t_time_p3 DataFormats/t_time_p3.cpp)
target_link_libraries(
......@@ -78,6 +80,8 @@ target_link_libraries(
${Boost_LIBRARIES}
)
add_test(test_time_p3 t_time_p3)
add_executable(
t_stream_receiver
network/inter_objects_communication/t_stream_receiver.cpp
......@@ -148,3 +152,5 @@ target_link_libraries(
t_sharedqueue
${Boost_LIBRARIES}
)
add_test(test_sharedqueue t_sharedqueue)
......@@ -80,7 +80,7 @@ inline fine_time getDFHDayTime(const phase2::DataFrameHeader& header) {
// Time elapsed since last wrap
inline fine_time getDFHFullTime(const phase2::DataFrameHeader& header) {
return std::chrono::seconds(86400 * header.Days) +
return std::chrono::seconds(86400 * (header.Days - 1)) +
getDFHDayTime(header);
}
......
......@@ -141,7 +141,7 @@ fine_time getDFHDayTime(phase3::DataFrameHeader const& header)
inline
fine_time getDFHYearTime(phase3::DataFrameHeader const& header)
{
return std::chrono::seconds(86400 * getDFHDays(header)) +
return std::chrono::seconds(86400 * (getDFHDays(header) - 1)) +
getDFHDayTime(header);
}
......@@ -163,11 +163,12 @@ fine_time getDFHFullTime(phase3::DataFrameHeader const& header)
}
// Set the Days field. "gregorian" is a number representing the number of
// days since the start of the year. 1 Jan == 0
// days since the start of the year. 1 Jan == 1
inline
void setDFHDays(unsigned int gregorian, phase3::DataFrameHeader& header)
{
assert(gregorian);
assert(gregorian < 367);
unsigned int const hundreds = gregorian / 100;
unsigned int const tens = (gregorian % 100) / 10;
......@@ -207,7 +208,7 @@ void setDFHYearTime(fine_time const& time, phase3::DataFrameHeader& header)
{
days const gregorian = std::chrono::duration_cast<days>(time);
setDFHDays(gregorian.count(), header);
setDFHDays(gregorian.count() + 1, header);
setDFHDayTime(time - gregorian, header);
}
......
......@@ -8,7 +8,7 @@ int main()
{
phase3::DataFrameHeader dfh;
for (unsigned gregorian = 0; gregorian < 367; ++gregorian) {
for (unsigned gregorian = 1; gregorian != 367; ++gregorian) {
phase3::setDFHDays(gregorian, dfh);
BOOST_TEST_EQ(phase3::getDFHDays(dfh), gregorian);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment