Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hyp.ker.time.h

00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Hyperion Pattern.
00004  Hyperion Pattern is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: pierre_rebours@yahoo.com
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
00024 
00025  Acknowledgements stx
00026  Creation 20/04/01 PR
00027 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00028 */
00029 
00030 
00031 #ifndef _hyp_ker_time_h_
00032 #define _hyp_ker_time_h_
00033 
00034 #ifndef hyp_KERNEL_CORE_INSIDE
00035 #error Inclusion not allowed (include hyp.kernel.core.h instead)
00036 #endif
00037 
00038 class hyp_ker_DLL CTime
00039 {
00041         t_int64 m_Sec;
00042 
00044         t_ulong m_NanoSec;
00045 
00046 public:
00047         CTime();        
00048         CTime(t_int64,t_ulong =0);
00049 
00058         t_ulong GetExtraMilliSec() const { return m_NanoSec / 1000000UL; }
00059         t_ulong GetExtraMicroSec() const { return m_NanoSec / 1000UL; }
00060         t_ulong GetExtraNanoSec() const { return m_NanoSec; }
00062 
00063   
00070         t_int64 GetNanoSec() const   { return m_Sec * 1000000000UL + m_NanoSec; }
00071         t_int64 GetMicroSec() const   { return m_Sec * 1000000UL    + m_NanoSec / 1000UL; }
00072         t_int64 GetMilliSec() const   { return m_Sec * 1000UL       + m_NanoSec / 1000000UL; }
00073         t_int64 GetSec() const    { return m_Sec; }
00074         t_int64 GetMinute() const { return m_Sec /   60UL; }
00075         t_int64 GetHour() const   { return m_Sec /   3600UL; }
00076         t_int64 GetDay() const    { return m_Sec / ( 3600UL * 24UL ); }
00077         t_int64 GetWeek() const   { return m_Sec / ( 3600UL * 24UL * 7UL ); }
00079 
00080         CTime& operator+=(const CTime& );
00081         CTime& operator-=(const CTime& );
00082         bool operator==(const CTime& ) const;
00083         bool operator!=(const CTime& ) const;
00084   
00085         bool IsInfinite() const;
00086         void SetInfinite();
00087         
00088         void SetCurrent();  
00089         void SetCurrentGMT();
00090         void SetCurrentLocalGMT();
00091         void Set(
00092                 t_ulong,
00093                 t_ulong,
00094                 t_ulong,
00095                 t_ulong = 0,
00096                 t_ulong = 0,
00097                 t_ulong = 0,
00098                 t_ulong = 0 );
00099  
00100 
00101         t_ulong Year() const;
00102         t_ulong Month() const;
00103         t_ulong Day() const;
00104         t_ulong Hour() const;
00105         t_ulong Minute() const;
00106         t_ulong Second() const;
00107         t_ulong NanoSecond() const;
00108         
00109         friend hyp_ker_DLL std::ostream& operator<<(std::ostream&,const CTime&);        
00110 };
00111 
00112 #endif
00113 

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.