Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trying to use std::get_time to parse YYMMDD and failing

I'm trying to do this and failing:

std::istringstream ss("1212");
ss >> std::get_time(&t, "%y%m");
if (ss.fail()) // every time!

this works ok:

std::istringstream ss("12-12");
ss >> std::get_time(&t, "%y-%m");

Any ideas what i'm doing wrong? what can i use otherwise as windows doesnt appear to have a srtptime

windows/vs13 TIA

like image 716
push 22 Avatar asked Jan 27 '16 15:01

push 22


1 Answers

Visual Studio does not seem to implement the spec properly, nor did GCC until version 5.0. If you continue to use std::get_time with VS13 or even VS15, you will need to manually add delimiters to be able to parse times until they finally get around to realizing this bug.

like image 105
Brandon Avatar answered Sep 26 '22 07:09

Brandon