Skip to content

Commit

Permalink
Add microseconds to BUFR message
Browse files Browse the repository at this point in the history
  • Loading branch information
istvans-mn committed Apr 9, 2024
1 parent 4f60fa9 commit 7c73095
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ingest/src/ingest/bufr/ESOHBufr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,16 @@ std::list<std::string> ESOHBufr::msg() const {
// pubtime
rapidjson::Value pubtime;
{
time_t pubtime_value = time(0);
struct timeval tv;
gettimeofday(&tv, 0);
const int date_len = 50;
char date_str[date_len];
size_t dl =
strftime(date_str, date_len, "%FT%H:%M:%S%z", gmtime(&pubtime_value));
size_t dl = strftime(date_str, date_len, "%FT%H:%M:%S.000000%z",
gmtime(&(tv.tv_sec)));
char usec[8];
sprintf(usec, "%06ld", tv.tv_usec);
// Copy microseconds into the date char string
memcpy(date_str + 20, usec, 6);
pubtime.SetString(date_str, static_cast<rapidjson::SizeType>(dl),
message_allocator);
}
Expand Down Expand Up @@ -858,7 +863,8 @@ bool ESOHBufr::setDateTime(struct tm *meas_datetime,

const int date_len = 50;
char date_str[date_len];
size_t dl = strftime(date_str, date_len, "%FT%H:%M:%S%z", meas_datetime);
size_t dl =
strftime(date_str, date_len, "%FT%H:%M:%S.000000%z", meas_datetime);

datetime.SetString(date_str, static_cast<rapidjson::SizeType>(dl),
message_allocator);
Expand All @@ -882,7 +888,7 @@ bool ESOHBufr::setStartDateTime(struct tm *start_meas_datetime,
const int date_len = 50;
char date_str[date_len];
size_t dl =
strftime(date_str, date_len, "%FT%H:%M:%S%z", start_meas_datetime);
strftime(date_str, date_len, "%FT%H:%M:%S.000000%z", start_meas_datetime);

start_datetime.SetString(date_str, static_cast<rapidjson::SizeType>(dl),
message_allocator);
Expand Down

1 comment on commit 7c73095

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API Unit Test Coverage Report
FileStmtsMissCoverMissing
\_\_init\_\_.py00100% 
datastore_pb2.py584621%24–69
datastore_pb2_grpc.py432347%37–52, 85–87, 92–94, 99–101, 106–108, 112–136, 174, 191, 208, 225
grpc_getter.py201145%15–16, 20–23, 27–29, 33–35
locustfile.py15150%1–31
main.py34585%41, 51–52, 62–63
metadata_endpoints.py552555%42–51, 55, 72–151, 155
response_classes.py50100% 
utilities.py681972%15, 33, 40, 62–65, 73–80, 85–92, 112, 116, 118
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   \_\_init\_\_.py110100% 
   covjson.py53198%75
   geojson.py15287%17, 42
routers
   \_\_init\_\_.py00100% 
   edr.py121794%131, 143, 151, 264–265, 310–311
   feature.py461959%75–108, 124–129, 135–157
TOTAL55017369% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
23 0 💤 0 ❌ 0 🔥 1.968s ⏱️

Please sign in to comment.