00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "typedefs.h" 00017 /*****************+***********+****************************************/ 00018 /* */ 00019 /* GSI, Gesellschaft fuer Schwerionenforschung mbH */ 00020 /* Postfach 11 05 52 */ 00021 /* D-64220 Darmstadt */ 00022 /* */ 00023 /*1+ C Procedure *************+****************************************/ 00024 /* */ 00025 /*+ Module : f_ut_time */ 00026 /* */ 00027 /*--------------------------------------------------------------------*/ 00028 /*+ CALLING : CHARS * = f_ut_time(CHARS *) */ 00029 /*--------------------------------------------------------------------*/ 00030 /* */ 00031 /*+ PURPOSE : Returns date/time string in format */ 00032 /* day-month-year hours:min:sec */ 00033 /* must be linked on Lynx with -X (=posix library) */ 00034 /* because of the time correction done. */ 00035 /* On VMS with /PREF=ALL */ 00036 /* */ 00037 /*3+Function******+***********+****************************************/ 00038 /* */ 00039 /* Length of returned string is 17. No \n. */ 00040 /* */ 00041 /*3+Examples******+***********+****************************************/ 00042 /* Description */ 00043 /*2+Implementation************+****************************************/ 00044 /*+ Utility : util */ 00045 /*+ File name : f_ut_time.c */ 00046 /*+ Home direct.: path */ 00047 /*+ Declaration : CHARS *f_ut_time(CHARS *); */ 00048 /*+ Version : 1.01 */ 00049 /*+ Author : H.G.Essel */ 00050 /*+ Created : 24-Mar-1994 */ 00051 /*+ Object libr.: */ 00052 /*+ Updates : Date Purpose */ 00053 /*- : 03-apr-97 : support VMS, AIX, DECunix, Lynx */ 00054 /*1- C Procedure *************+****************************************/ 00055 #ifdef Lynx 00056 #include <types.h> 00057 #include <timeb.h> 00058 #else 00059 #include <sys/types.h> 00060 #include <sys/timeb.h> 00061 #endif 00062 #include <stdio.h> 00063 #include <time.h> 00064 00065 CHARS *f_ut_time (CHARS *pc_time) 00066 { 00067 00068 time_t t_time; 00069 struct timeb tp; 00070 struct tm st_time; 00071 00072 ftime (&tp); 00073 00074 #ifdef Lynx 00075 /* Note: due to an error in POSIX Version of localtime, 1 day has to be */ 00076 /* added to get the correct date. During daylight saving period 1 hour */ 00077 /* has to be added additionaly */ 00078 tp.time+=86400; /* add 1 day */ 00079 localtime_r(&st_time,&tp.time); 00080 if(st_time.tm_mon > 2 && st_time.tm_mon < 9) /* daylight saving ? */ 00081 { 00082 tp.time+=3600; 00083 localtime_r(&st_time,&tp.time); 00084 } 00085 #else 00086 st_time=*localtime(&tp.time); 00087 #endif 00088 00089 strftime(pc_time,30,"%d-%h-%y %T",&st_time); 00090 return ((CHARS *) pc_time); 00091 } 00092 00093 //----------------------------END OF GO4 SOURCE FILE ---------------------