root/experimental/NT-based/NTSpecific/SystemTime.hpp

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. SystemTime
  2. SystemTimeAsStr

   1 /******************************************************************************
   2 ** $Header: svn+ssh://jmmcg@svn.code.sf.net/p/libjmmcg/code/trunk/libjmmcg/experimental/NT-based/NTSpecific/SystemTime.hpp 2055 2017-05-13 19:35:47Z jmmcg $
   3 ** 
   4 ** Copyright (C) 2002 by J.M.McGuiness, coder@hussar.me.uk
   5 **
   6 ** This library is free software; you can redistribute it and/or
   7 ** modify it under the terms of the GNU Lesser General Public
   8 ** License as published by the Free Software Foundation; either
   9 ** version 2.1 of the License, or (at your option) any later version.
  10 **
  11 ** This library is distributed in the hope that it will be useful,
  12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14 ** Lesser General Public License for more details.
  15 **
  16 ** You should have received a copy of the GNU Lesser General Public
  17 ** License along with this library; if not, write to the Free Software
  18 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19 */
  20 
  21 #pragma once
  22 
  23 #include"../../../core/ttypes.hpp"
  24 #include<iomanip>
  25 #include<ostream>
  26 #include<sstream>
  27 #include<string>
  28 
  29 namespace jmmcg {
  30 
  31         namespace NTUtils {
  32 
  33                 inline tostream &SystemTime(tostream &ss) {
  34                         SYSTEMTIME time;
  35                         ::GetSystemTime(&time);
  36                         ss<<std::setw(2)<<std::setfill(_T('0'))<<time.wHour<<_T(':')
  37                                 <<std::setw(2)<<std::setfill(_T('0'))<<time.wMinute<<_T(':')
  38                                 <<std::setw(2)<<std::setfill(_T('0'))<<time.wSecond<<_T('.')
  39                                 <<std::setw(3)<<std::setfill(_T('0'))<<time.wMilliseconds<<_T(" - ")
  40                                 <<std::setw(2)<<std::setfill(_T('0'))<<time.wDay<<_T('/')
  41                                 <<std::setw(2)<<std::setfill(_T('0'))<<time.wMonth<<_T('/')
  42                                 <<std::setw(2)<<std::setfill(_T('0'))<<time.wYear;
  43                         return ss;
  44                 }
  45 
  46                 inline tstring SystemTimeAsStr(void) {
  47                         tstringstream ss;
  48                         SystemTime(ss);
  49                         return ss.str();
  50                 }
  51 
  52         }
  53 
  54 }

/* [<][>][^][v][top][bottom][index][help] */