ClockConverter.h

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Laurent Pereira
00022 */
00023 
00024 
00025 
00026 #ifndef _EYEDB_CLOCK_CONVERTER_H
00027 #define _EYEDB_CLOCK_CONVERTER_H
00028 
00029 #include <eyedb/eyedb.h>
00030 
00031 namespace eyedb {
00032 
00039   class ClockConverter
00040   {
00041   
00042   private:
00043     char * string_clock;
00044     char * string_zone;
00045 
00046 
00047   public:
00048 
00049     ClockConverter();
00050     virtual ~ClockConverter();
00051 
00052 
00053 
00054 
00064     void usec2clock(const eyedblib::int64 usec, eyedblib::int16 * hour = 0, eyedblib::int16 * min = 0, eyedblib::int16 *sec = 0, eyedblib::int16 * ms = 0, eyedblib::int16 *us = 0);
00074     void clock2usec(eyedblib::int64 *usec, const eyedblib::int16 hour = 0, const eyedblib::int16 min = 0, const eyedblib::int16 sec = 0, const eyedblib::int16 ms = 0, const eyedblib::int16 us = 0);
00075 
00076   
00082     eyedblib::int32 usec2day(eyedblib::int64 usec);
00083 
00084 
00088     void tz2clock(const eyedblib::int16 tz, eyedblib::int16 * hour, eyedblib::int16 * min);
00089 
00093     void clock2tz(eyedblib::int16 * tz, const eyedblib::int16 hour, const eyedblib::int16 min);
00094 
00095 
00102     eyedblib::int64 ascii2usec(const char * t);
00103 
00108     char * usec2ascii(const eyedblib::int64 usec);
00109 
00110 
00117     eyedblib::int16 ascii2tz(const char * tz);
00118 
00123     char * tz2ascii(const eyedblib::int16 tz);
00124 
00125 
00126 
00127 
00131     eyedblib::int64 current_time();
00132  
00133   
00138     eyedblib::int16 local_timezone();
00139 
00140   };
00141 
00142 
00143   //
00144   // Constants
00145   //
00146 
00147   extern const eyedblib::int64 USEC_OF_DAY;
00148   extern const eyedblib::int64 USEC_OF_HOUR;
00149   extern const eyedblib::int32 USEC_OF_MINUTE;
00150   extern const eyedblib::int32 USEC_OF_SECOND;
00151   extern const eyedblib::int16 USEC_OF_MILLISECOND;
00152   extern const eyedblib::int16 MAX_TZ;
00153   extern const eyedblib::int16 MIN_TZ;
00154 }
00155 
00156 #endif

Generated on Mon Dec 22 18:15:51 2008 for eyedb by  doxygen 1.5.3