mirror of https://gitee.com/bigwinds/arangodb
90 lines
2.5 KiB
C
90 lines
2.5 KiB
C
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief High-Performance Database Framework made by triagens
|
|
///
|
|
/// @file
|
|
///
|
|
/// DISCLAIMER
|
|
///
|
|
/// Copyright 2010-2011 triagens GmbH, Cologne, Germany
|
|
///
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
/// you may not use this file except in compliance with the License.
|
|
/// You may obtain a copy of the License at
|
|
///
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
///
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
/// See the License for the specific language governing permissions and
|
|
/// limitations under the License.
|
|
///
|
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
|
///
|
|
/// @author Dr. Frank Celler
|
|
/// @author Copyright 2009-2011, triAGENS GmbH, Cologne, Germany
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include <Basics/Common.h>
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// --SECTION-- public functions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @addtogroup OperatingSystem
|
|
/// @{
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief safe gmtime
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void TRI_gmtime (time_t tt, struct tm* tb) {
|
|
#ifdef TRI_HAVE_GMTIME_R
|
|
|
|
gmtime_r(&tt, tb);
|
|
|
|
#else
|
|
|
|
#ifdef TRI_HAVE_GMTIME_S
|
|
|
|
gmtime_s(tb, &tt);
|
|
|
|
#else
|
|
|
|
struct tm* tp;
|
|
|
|
tp = gmtime(&tt);
|
|
|
|
if (tp != NULL) {
|
|
memcpy(tb, tp, sizeof(struct tm));
|
|
}
|
|
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @brief seconds with microsecond resolution
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
double TRI_microtime () {
|
|
struct timeval t;
|
|
|
|
gettimeofday(&t, 0);
|
|
|
|
return (t.tv_sec) + (t.tv_usec / 1000000.0);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// @}
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Local Variables:
|
|
// mode: outline-minor
|
|
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\)"
|
|
// End:
|
|
|
|
|