Skip to content
Snippets Groups Projects
Commit c2fc6cb6 authored by Rene Redler's avatar Rene Redler
Browse files

update to latest mtime

see git@git.mpimet.mpg.de:libmtime.git for further details
parent 42926a8e
No related branches found
No related tags found
No related merge requests found
/** @file libmtime.h Documentation header file */
/** @mainpage libmtime - A model time management library
*
* This project aims to provide time, calenendar, and event handling
* for model applications.
*
* libmtime provides the following simple and well documented data structures of
* common use:
*
* @arg calendar: The base calendar; either proleptic Gregorian, 365 day years, or 360 day years calendar.
* @arg date: A calendars date.
* @arg time: A time at a day.
* @arg datetime: Date and time combined.
* @arg timedelta: A difference in datetime.
* @arg julianday: The Julian day to define the base time axis.
*
* @section CompileInstall Compilation and installation
*
* You can obtain the source code tarball on site
*
* This software uses the GNU Autotools build system: in order to
* compile and install the application the standard installation
* method must be used:
@verbatim
./configure
make
make install
@endverbatim
*
* More information is provided by the INSTALL file, which is
* included in the software package.
*
* @section Usage
*
* The doxygen documentation you are reading is pretty rich. You
* are still recomended to take a look at the libmtime/test directory,
* which contains some usage examples.
*
* @section License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @section Dependency
*
* The library should work correctly without any dependency under any
* Posix-compliant operating system. If you experience some issue
* please contact me. The AUTHORS file provided with the software
* distribution contain developers contacts.
*
*/
/** @defgroup libmtime
*
* This library provides time, calenendar, and event handling
* for model applications.
*/
/** @defgroup CBindings C language bindings
* @ingroup libmtime
*
* This module documents the C language bindings
*/
/** @defgroup FortranBindings Fortran language bindings
* @ingroup libmtime
*
* This module documents the Fortran language bindings
*/
......@@ -50,13 +50,13 @@ newJulianDay(int64_t _day, int64_t _ms);
void
deallocateJulianDay(struct _julianday* jd);
/*! \cond PRIVATE */
struct _juliandelta*
newJulianDelta(char _sign, int64_t _day, int64_t _ms);
void
deallocateJulianDelta(struct _juliandelta* jd);
/*! \cond PRIVATE */
struct _julianday*
addJulianDelta(struct _julianday* jd1, struct _juliandelta* jd2, struct _julianday* jd);
......
......@@ -79,13 +79,11 @@ compareTimeDelta(struct _timedelta* td1, struct _timedelta* td2);
struct _timedelta*
replaceTimeDelta(struct _timedelta* tdsrc, struct _timedelta* tddest);
/*! \cond PRIVATE */
struct _juliandelta*
timeDeltaToJulianDelta(struct _timedelta *td, struct _datetime *dt, struct _juliandelta *jd);
struct _timedelta*
julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime *dt, struct _timedelta* td_return);
/*! \endcond */
struct _divisionquotienttimespan*
divideTimeDeltaInSeconds(struct _timedelta* dividend, struct _timedelta* divisor, struct _divisionquotienttimespan* quo_ret);
......
......@@ -11,6 +11,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include "mtime_calendarGregorian.h"
#include "mtime_julianDay.h"
......@@ -20,22 +21,13 @@
static const int msn[12] =
{ 0, 31, 61, 92, 122, 153, 184, 214, 245, 275, 306, 337 };
/* Internal function. */
/* Compute floor division */
static
int64_t
ifloor(int64_t ir1, int64_t ir2)
{
int64_t r;
int64_t ifl;
r = (ir1 % ir2);
ifl = ir1 / ir2;
if (r < 0)
{
ifl = ifl - 1;
}
return ifl;
lldiv_t r = lldiv(ir1, ir2);
return r.quot - (r.rem < 0);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment