InfluxDB-Client-for-Arduino icon indicating copy to clipboard operation
InfluxDB-Client-for-Arduino copied to clipboard

getTimeStamp signature

Open fl4p opened this issue 2 years ago • 1 comments

Hi, thanks for this lib.

Signature of getTimeStamp(struct timeval *tv, int secFracDigits) should be getTimeStamp(const struct timeval *tv, int secFracDigits), so we don't have to cast away the const when using this func externally.

Or even better, consider using references to match the general C++ style: getTimeStamp(const struct timeval &tv, int secFracDigits)

fl4p avatar Mar 09 '23 08:03 fl4p

Thanks, @fl4p, for the feedback. I admit there should be the const qualified before struct timeval *tv. However, its usage should stay idiomatic. As the struct timeval is from C time API, it is mostly used as a pointer and it is better to keep it so.

vlastahajek avatar Mar 10 '23 13:03 vlastahajek