- Create the cache directly from the schema (installed) file.
[platform/upstream/libzypp.git] / zypp / Date.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/Date.cc
10  *
11 */
12 #include <iostream>
13 //#include "zypp/base/Logger.h"
14
15 #include "zypp/base/String.h"
16
17 #include "zypp/Date.h"
18
19 using std::endl;
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24
25   ///////////////////////////////////////////////////////////////////
26   //
27   //    METHOD NAME : Date::Date
28   //    METHOD TYPE : Constructor
29   //
30   Date::Date( const std::string & seconds_r )
31   { str::strtonum( seconds_r, _date ); }
32
33   ///////////////////////////////////////////////////////////////////
34   //
35   //    METHOD NAME : Date::form
36   //    METHOD TYPE : std::string
37   //
38   std::string Date::form( const std::string & format_r ) const
39   {
40     static char buf[1024];
41     if ( ! strftime( buf, 1024, format_r.c_str(), localtime( &_date ) ) )
42       return std::string();
43     return buf;
44   }
45
46   /////////////////////////////////////////////////////////////////
47 } // namespace zypp
48 ///////////////////////////////////////////////////////////////////