00001 /* 00002 * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 1999-2001, Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any 00016 license provided herein, whether implied or otherwise, is limited to 00017 this program in accordance with the express provisions of the 00018 GNU Lesser General Public License. 00019 00020 Patent licenses, if any, provided herein do not apply to combinations 00021 of this program with other product or programs, or any other product 00022 whatsoever. This program is distributed without any warranty that the 00023 program is delivered free of the rightful claim of any third person by 00024 way of infringement or the like. 00025 00026 See the GNU Lesser General Public License for more details. 00027 00028 You should have received a copy of the GNU General Public License along 00029 with this program; if not, write the Free Software Foundation, Inc., 59 00030 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00031 00032 */ 00033 00034 00035 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/time_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00036 /* 00037 * 00038 * return the current time as an integer 00039 * 00040 * calling sequence: 00041 * integer time 00042 * i = time() 00043 * where: 00044 * i will receive the current GMT in seconds. 00045 * 00046 * return the current time as a character string 00047 * 00048 * calling sequence: 00049 * charater timebuf*8 00050 * call time(timebuf) 00051 * where: 00052 * timebuf will receive the current time in the format hh:mm:ss 00053 * 00054 */ 00055 00056 #include <sys/types.h> 00057 #if defined(_SYSV) || defined(_SYSTYPE_SVR4) || defined (KEY) 00058 #include <time.h> 00059 #else 00060 #include <sys/time.h> 00061 #endif 00062 #include <string.h> 00063 00064 #ifdef KEY /* Bug 4135, 5019 */ 00065 00066 #include "pathf90_libU_intrin.h" 00067 00068 #include <alloca.h> 00069 00070 #define CTIME_BUFLEN 26 00071 00072 pathf90_i4 00073 pathf90_time4(void) 00074 { 00075 return (pathf90_i4) time(NULL); 00076 } 00077 00078 pathf90_i8 00079 pathf90_time8(void) 00080 { 00081 return (pathf90_i8) time(NULL); 00082 } 00083 00084 void 00085 pathf90_subr_time(char *buf, int len) 00086 { 00087 char result[CTIME_BUFLEN]; 00088 time_t t = time(0); 00089 memset(buf, ' ', len); 00090 memcpy(buf, ctime_r(&t, result) + 11, (len < 8) ? len : 8); 00091 } 00092 00093 #else 00094 extern time_t 00095 #if defined(__ia64) || defined(__ia32) 00096 __attribute__ ((weak)) time_(void) 00097 #else 00098 time_(void) 00099 #endif 00100 { 00101 return(time(NULL)); 00102 } 00103 #endif /* Bug 4135, 5019 */ 00104 00105 extern void 00106 #if defined(__ia64) || defined(__ia32) 00107 _TIME (char timebuf[]) 00108 #else 00109 time_vms (char timebuf[]) 00110 #endif 00111 { 00112 time_t t; 00113 00114 t = time(0); 00115 strncpy(timebuf,ctime(&t)+11,8); 00116 }
1.5.6