00001 /* 00002 * Name: gmt_date.cc 00003 * Author: Francisco Rodrigo Escobedo Robles 00004 * Contributor: Rafael Jesus Alcantara Perez 00005 * Summary: GMT date class 00006 * Date: $Date: 2003/04/14 00:18:35 $ 00007 * Revision: $Revision: 1.1 $ 00008 * 00009 * Copyright (C) 2000 Francisco Rodrigo Escobedo Robles <frer@pepix.net> 00010 * Copyright (C) 2002 Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com> 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with this program; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00025 * MA 02111-1307, USA. 00026 */ 00027 00028 #include <ctime> 00029 #include <mpcl/text/gmt_date.hh> 00030 00031 00032 // 00033 // S E L E C T O R S 00034 // 00035 00036 mpcl::text::TString mpcl::text::TGmtDate:: 00037 get (const char* pkcDATE_FORMAT) const 00038 { 00039 00040 char acFormattedDate [_kiMaxFormattedDate]; 00041 00042 if ( !std::strftime ( acFormattedDate , 00043 _kiMaxFormattedDate , 00044 pkcDATE_FORMAT , 00045 std::gmtime (&tSecondsFromEpoch) ) ) 00046 { 00047 throw TConstraintException ("date too long", __FILE__, __LINE__); 00048 } 00049 return TString (acFormattedDate); 00050 00051 } // get()