• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

ink_time.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /****************************************************************************
00025 
00026   ink_time.h
00027 
00028   Timing routines for libts
00029 
00030 
00031 
00032  ****************************************************************************/
00033 
00034 #ifndef _ink_time_h_
00035 #define _ink_time_h_
00036 
00037 #include "ink_platform.h"
00038 #include "ink_defs.h"
00039 #include "ink_hrtime.h"
00040 
00041 /*===========================================================================*
00042 
00043                                  Data Types
00044 
00045  *===========================================================================*/
00046 
00047 typedef time_t ink_time_t;
00048 
00049 /*===========================================================================*
00050 
00051                                  Prototypes
00052 
00053  *===========================================================================*/
00054 
00055 #define MICRO_USER 1
00056 #define MICRO_SYS 2
00057 #define MICRO_REAL 3
00058 #define UNDEFINED_TIME ((time_t)0)
00059 
00060 uint64_t ink_microseconds(int which);
00061 double ink_time_wall_seconds();
00062 
00063 int cftime_replacement(char *s, int maxsize, const char *format, const time_t * clock);
00064 #define cftime(s, format, clock) cftime_replacement(s, 8192, format, clock)
00065 
00066 ink_time_t convert_tm(const struct tm *tp);
00067 
00068 inkcoreapi char *ink_ctime_r(const ink_time_t * clock, char *buf);
00069 inkcoreapi struct tm *ink_localtime_r(const ink_time_t * clock, struct tm *res);
00070 
00071 /*===========================================================================*
00072                               Inline Stuffage
00073  *===========================================================================*/
00074 #if defined(freebsd) || defined(openbsd)
00075 
00076 inline int
00077 ink_timezone()
00078 {
00079   struct timeval tp;
00080   struct timezone tzp;
00081   ink_assert(!gettimeofday(&tp, &tzp));
00082   return tzp.tz_minuteswest * 60;
00083 }
00084 
00085 #else  // non-freebsd, non-openbsd for the else
00086 
00087 inline int
00088 ink_timezone()
00089 {
00090   return timezone;
00091 }
00092 
00093 #endif /* #if defined(freebsd) || defined(openbsd) */
00094 
00095 #endif /* #ifndef _ink_time_h_ */

Generated by  doxygen 1.7.1