localtime_sでええやないか

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <time.h>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;



int main(int argc, char* argv[])
{
	time_t now = time(nullptr);
#if 0
	tm nowtm = *localtime(&now);
#else
	tm nowtm;
	localtime_s(&nowtm, &now);
#endif
	cout << nowtm.tm_year+1900 << "/" << nowtm.tm_mon << "/" << nowtm.tm_mday << endl;
	cout << nowtm.tm_hour << ":" << nowtm.tm_min << ":" << nowtm.tm_sec << endl;
	return 0;