Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef REPLAYTIME_H
  5. #define REPLAYTIME_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. class KeyValues;
  11. //----------------------------------------------------------------------------------------
  12. #include "vgui/ILocalize.h"
  13. //----------------------------------------------------------------------------------------
  14. class CReplayTime
  15. {
  16. public:
  17. CReplayTime();
  18. void InitDateAndTimeToNow();
  19. void Read( KeyValues *pIn );
  20. void Write( KeyValues *pOut );
  21. // Modifiers:
  22. void SetDate( int nDay, int nMonth, int nYear );
  23. void SetTime( int nHour, int nMin, int nSec );
  24. inline void SetRawDate( int nRawDate ) { m_fDate = nRawDate; }
  25. inline void SetRawTime( int nRawTime ) { m_fTime = nRawTime; }
  26. // Accessors:
  27. void GetTime( int &nHour, int &nMin, int &nSec ) const;
  28. void GetDate( int &nDay, int &nMonth, int &nYear ) const;
  29. static const char *FormatTimeString( int nSecs );
  30. static const char *FormatPreciseTimeString( float flSecs );
  31. static const wchar_t *GetLocalizedMonth( vgui::ILocalize *pLocalize, int nMonth );
  32. static const wchar_t *GetLocalizedDay( vgui::ILocalize *pLocalize, int nDay );
  33. static const wchar_t *GetLocalizedYear( vgui::ILocalize *pLocalize, int nYear );
  34. static const wchar_t *GetLocalizedTime( vgui::ILocalize *pLocalize, int nHour, int nMin, int nSec );
  35. static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, int nDay, int nMonth, int nYear,
  36. int *pHour = NULL, int *pMin = NULL, int *pSec = NULL, bool bForceFullFormat = false ); // bForceFullFormat true will keep from returning "today" or "yesterday"
  37. static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, const CReplayTime &t, bool bForceFullFormat = false );
  38. int m_fDate; // Representation of a date (bitfield)
  39. int m_fTime; // Representation of time (bitfield)
  40. };
  41. //----------------------------------------------------------------------------------------
  42. #endif // REPLAYTIME_H