-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove BH dependency #297
Remove BH dependency #297
Conversation
utils.h still imports boost/date_time.hpp
For testing, I tried replacing the locale ( |
It's nice that you can remove all of the manual conversion stuff up above by setting the locale for the stream object. Just curious: do you know what it does with the day of week (like |
To answer my own question: the day of week gets put in the cpp11::cpp_source(
code = '
#include <cpp11.hpp>
#include <sstream>
#include <iomanip>
using namespace cpp11;
[[cpp11::register]]
cpp11::integers datetest(std::string date) {
std::tm t = {};
std::istringstream date_ss(date);
date_ss >> std::get_time(&t, "%a, %d %b %Y %H:%M:%S GMT");
return writable::integers({
t.tm_isdst,
t.tm_yday,
t.tm_wday,
t.tm_year,
t.tm_mon,
t.tm_mday,
t.tm_hour,
t.tm_min,
t.tm_sec
});
}
')
datetest("Tue, 30 Mar 2021 15:14:00 GMT")
#> [1] 0 0 2 121 2 30 15 14 0
datetest("Wed, 30 Mar 2021 15:14:00 GMT")
#> [1] 0 0 3 121 2 30 15 14 0 But I think it gets ignored for date-time comparisons later on. |
As of gcc 4.9.3 (which I believe is the version included with rtools 3.5), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One piece of code that should be changed, but otherwise looks good.
Co-authored-by: Winston Chang <[email protected]>
Replaced boost/optional with https://github.com/akrzemi1/Optional.
parse_http_date_string()
used boost/date_time; replaced this withsscanf()
andtimegm()
. Buttimegm()
isn't available on mingw, and the first workaround I tried caused the DLL not to load during CI. The final workaround reimplementstimegm()
using Win32 APIs.See also r-lib/later#147