00001 #include "common/logging-time.h" 00002 00003 #if __DO_LOGGING__ 00004 00005 void log_time_f(const char *logfile, time_t t) 00006 { 00007 char buf[100]; 00008 struct tm result_tm; 00009 if (!gmtime_r(&t, &result_tm)) { 00010 return; // error 00011 } 00012 size_t r = strftime(buf, sizeof(buf), "%F %T UTC", &result_tm); 00013 if (r == 0) return; // did not fit into buffer 00014 log_text(logfile, buf); 00015 } 00016 00017 #endif // __DO_LOGGING__ 00018 00019 /** 00020 00021 logging-time.c 00022 00023 Copyright 2009 Helsinki Institute for Information Technology (HIIT) 00024 and the authors. All rights reserved. 00025 00026 Authors: Tero Hasu <tero.hasu@hut.fi> 00027 00028 Permission is hereby granted, free of charge, to any person 00029 obtaining a copy of this software and associated documentation files 00030 (the "Software"), to deal in the Software without restriction, 00031 including without limitation the rights to use, copy, modify, merge, 00032 publish, distribute, sublicense, and/or sell copies of the Software, 00033 and to permit persons to whom the Software is furnished to do so, 00034 subject to the following conditions: 00035 00036 The above copyright notice and this permission notice shall be 00037 included in all copies or substantial portions of the Software. 00038 00039 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00040 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00041 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00042 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00043 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00044 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00045 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00046 SOFTWARE. 00047 00048 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:54 2011 by Doxygen 1.6.1