| 191 | } |
| 192 | |
| 193 | void |
| 194 | test_c() |
| 195 | { |
| 196 | using namespace date; |
| 197 | using namespace std::chrono; |
| 198 | { |
| 199 | // correct abbreviation |
| 200 | std::istringstream in{"Sun Dec 11 14:02:43 2016"}; |
| 201 | sys_seconds tp; |
| 202 | in >> parse("%c", tp); |
| 203 | assert(!in.fail()); |
| 204 | assert(!in.bad()); |
| 205 | assert(tp == sys_days{2016_y/12/11} + hours{14} + minutes{2} + seconds{43}); |
| 206 | } |
| 207 | { |
| 208 | // can't parse negative years with "%c" directly |
| 209 | std::istringstream in{"Sun Dec 11 14:02:43 -2016"}; |
| 210 | sys_seconds tp; |
| 211 | in >> parse("%c", tp); |
| 212 | assert(in.fail()); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | void |
| 217 | test_x() |