libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
media
misc
parser
pool
repo
sat
solver
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
Date.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_DATE_H
13
#define ZYPP_DATE_H
14
15
#include <ctime>
16
#include <iosfwd>
17
#include <string>
18
19
#include "
zypp/base/Exception.h
"
20
22
namespace
zypp
23
{
24
26
//
27
// CLASS NAME : Date
28
//
31
class
Date
32
{
33
friend
std::ostream &
operator<<
( std::ostream & str,
const
Date
& obj );
34
35
public
:
36
37
typedef
time_t
ValueType
;
38
39
static
const
ValueType
second
= 1;
40
static
const
ValueType
minute
= 60;
41
static
const
ValueType
hour
= 3600;
42
static
const
ValueType
day
= 86400;
43
static
const
ValueType
month28
= 2419200;
44
static
const
ValueType
month29
= 2505600;
45
static
const
ValueType
month30
= 2592000;
46
static
const
ValueType
month31
= 2678400;
47
static
const
ValueType
month
=
month30
;
48
static
const
ValueType
year365
= 31536000;
49
static
const
ValueType
year366
= 31622400;
50
static
const
ValueType
year
=
year365
;
51
52
enum
TimeBase
{
TB_LOCALTIME
,
TB_UTC
};
53
55
Date
()
56
:
_date
( 0 )
57
{}
59
Date
(
ValueType
date_r )
60
:
_date
( date_r )
61
{}
63
Date
(
const
std::string & seconds_r );
64
71
Date
(
const
std::string & date_str,
const
std::string & format );
73
Date
(
const
std::string & date_str,
const
std::string & format,
TimeBase
base_r );
74
76
static
Date
now
()
77
{ return ::time( 0 ); }
78
79
public
:
81
operator
ValueType
()
const
82
{
return
_date
; }
83
88
Date
&
operator+=
(
const
time_t rhs ) {
_date
+= rhs;
return
*
this
; }
89
Date
&
operator-=
(
const
time_t rhs ) {
_date
-= rhs;
return
*
this
; }
90
Date
&
operator*=
(
const
time_t rhs ) {
_date
*= rhs;
return
*
this
; }
91
Date
&
operator/=
(
const
time_t rhs ) {
_date
/= rhs;
return
*
this
; }
92
93
Date
&
operator++
(
/*prefix*/
) {
_date
+= 1;
return
*
this
; }
94
Date
&
operator--
(
/*prefix*/
) {
_date
-= 1;
return
*
this
; }
95
96
Date
operator++
(
int
/*postfix*/
) {
return
_date
++; }
97
Date
operator--
(
int
/*postfix*/
) {
return
_date
--; }
99
100
public
:
107
std::string
form
(
const
std::string & format_r )
const
108
{
return
form
( format_r,
TB_LOCALTIME
); }
110
std::string
form
(
const
std::string & format_r,
TimeBase
base_r )
const
;
111
115
std::string
asString
()
const
116
{
return
form
(
"%c"
); }
117
121
std::string
asSeconds
()
const
122
{
return
form
(
"%s"
); }
123
124
private
:
129
ValueType
_date
;
130
};
132
134
inline
std::ostream &
operator<<
( std::ostream & str,
const
Date
& obj )
135
{
return
str << obj.
asString
(); }
136
137
class
DateFormatException
:
public
Exception
138
{
139
public
:
140
DateFormatException
(
const
std::string &
msg
) :
Exception
( msg )
141
{}
142
};
143
145
}
// namespace zypp
147
#endif // ZYPP_DATE_H
zypp
Date.h
Generated by
1.8.1