Formatting `ptime` does not produce time zone information in the output
- Dominant language
- C++
- Stars
- 70
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
When the time type is `boost::posix_time::ptime`, Boost.DateTime output facets don't produce any output for "%Z", "%z", "%Q" and "%q" flags.
Here is an example:
```
#include
#include
#include
#include
static const char format[] = "%Y-%m-%d %H:%M:%S %z";
int main()
{
auto *facet = new boost::posix_time::time_facet(format);
std::locale loc(std::locale(), facet);
std::locale::global(loc);
std::cout.imbue(loc);
auto now = boost::posix_time::microsec_clock::local_time();
std::cout << '"' << now << '"' << std::endl;
std::time_t time_t_now = boost::posix_time::to_time_t(now);
std::tm tm_buf = {};
std::tm* tm_now = boost::date_time::c_time::localtime(&time_t_now, &tm_buf);
char buf[128];
std::strftime(buf, sizeof(buf), format, tm_now);
std::cout << '"' << buf << '"' << std::endl;
}
```
Output:
```
"2023-07-02 17:36:16"
"2023-07-02 20:36:16 +0300"
```
I would expect the time zone format flags to work and result in the current system time zone in the output.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.