Scope
helpers.cpp
1 #include "stdafx.h"
2 #include "helpers.h"
3 
4 std::wstring GetCurrentDateString() {
5  SYSTEMTIME st;
6  GetLocalTime(&st);
7  std::wstringstream stream;
8  stream << std::setfill(L'0') << st.wYear << L"-" << std::setw(2) << st.wMonth << L"-" << std::setw(2) << st.wDay;
9  return stream.str();
10 }
11 
12 std::wstring GetCurrentTimeString(const bool& _filenamecompatible) {
13  SYSTEMTIME st;
14  GetLocalTime(&st);
15  std::wstringstream stream;
16  if ( _filenamecompatible ) // ISO standard says HH:MM:SS, but no : allowed in filenames
17  stream << std::setfill(L'0') << std::setw(2) << st.wHour << L"-" << std::setw(2) << st.wMinute << L"-" << std::setw(2) << st.wSecond;
18  else
19  stream << std::setfill(L'0') << std::setw(2) << st.wHour << L":" << std::setw(2) << st.wMinute << L":" << std::setw(2) << st.wSecond;
20  return stream.str();
21 }
This is the include file for standard system include files, or project specific include files that ar...
std::wstring GetCurrentDateString()
Definition: helpers.cpp:4
Various helper functions and classes for Scope.
std::wstring GetCurrentTimeString(const bool &_filenamecompatible)
Definition: helpers.cpp:12