Compare commits

..

No commits in common. "master" and "0.3.8" have entirely different histories.

32 changed files with 143 additions and 2292 deletions

View File

@ -292,4 +292,5 @@ done
exit 0 exit 0
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4 # vim: expandtab:ts=4:sw=4

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
# libiso8601/test.sh # libiso8601/test.sh
# #
# Copyright: ©20092011, Güralp Systems Ltd. # (c)2009, Laurence Withers, <l@lwithers.me.uk>.
# Author: Laurence Withers <lwithers@guralp.com> # Released under the GNU GPLv3. See file COPYING or
# License: GPLv3 # http://www.gnu.org/copyleft/gpl.html for details.
# #
# Running this script on its own will display a summary of all the # Running this script on its own will display a summary of all the
@ -21,7 +21,7 @@ run_test() {
return 1 return 1
fi fi
LD_LIBRARY_PATH="obj:${LD_LIBRARY_PATH}" "${EXE}" "$@" || return 1 LD_LIBRARY_PATH="obj" "${EXE}" "$@" || return 1
return 0 return 0
} }
@ -36,12 +36,11 @@ print_tests() {
[ -x "${EXE}" ] || continue [ -x "${EXE}" ] || continue
NAME="$(echo "${EXE}" | sed 's,obj/tests/,,')" NAME="$(echo "${EXE}" | sed 's,obj/tests/,,')"
echo -ne "${NAME}\t" echo -ne "${NAME}\t"
LD_LIBRARY_PATH="obj:${LD_LIBRARY_PATH}" "${EXE}" --print-summary LD_LIBRARY_PATH="obj" "${EXE}" --print-summary
done done
} }
# Main script # Main script
if [ $# -eq 0 ] if [ $# -eq 0 ]
then then
@ -49,6 +48,7 @@ then
exit 0 exit 0
fi fi
run_test "$@" run_test $*
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4 # vim: expandtab:ts=4:sw=4

1
scripts/.gitignore vendored
View File

@ -7,7 +7,6 @@ build.docs.none
build.files.none build.files.none
build.firmware.gpasm build.firmware.gpasm
build.firmware.sdcc build.firmware.sdcc
build.header.c
build.lib.c build.lib.c
build.lib.c++ build.lib.c++
build.make.none build.make.none

View File

@ -1,8 +1,8 @@
# libiso8601/scripts/functions.sh # libiso8601/scripts/functions.sh
# #
# Copyright: ©20072011, Güralp Systems Ltd. # (c)2007, Laurence Withers, <l@lwithers.me.uk>.
# Author: Laurence Withers, <lwithers@guralp.com> # Released under the GNU GPLv3. See file COPYING or
# License: GPLv3 # http://www.gnu.org/copyleft/gpl.html for details.
# #
# Common functions # Common functions
@ -63,4 +63,5 @@ do_cmd_redir() {
fi fi
} }
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4 # vim: expandtab:ts=4:sw=4

View File

@ -1,8 +1,8 @@
# libiso8601/scripts/paths # libiso8601/scripts/paths
# #
# Copyright: ©2011, Güralp Systems Ltd. # (c)2007, Laurence Withers, <l@lwithers.me.uk>.
# Author: Laurence Withers, <lwithers@guralp.com> # Released under the GNU GPLv3. See file COPYING or
# License: GPLv3 # http://www.gnu.org/copyleft/gpl.html for details.
# #
# Default path setup. Not meant for editing; use environment variables # Default path setup. Not meant for editing; use environment variables
# to override values if needed. # to override values if needed.
@ -60,4 +60,5 @@ fi
[ -z "${WEBDIR}" ] && WEBDIR="${SRVDIR}/http" [ -z "${WEBDIR}" ] && WEBDIR="${SRVDIR}/http"
[ -z "${CGIDIR}" ] && CGIDIR="${WEBDIR}/cgi-bin" [ -z "${CGIDIR}" ] && CGIDIR="${WEBDIR}/cgi-bin"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

File diff suppressed because it is too large Load Diff

View File

@ -39,4 +39,5 @@ then
docs_BUILT=1 docs_BUILT=1
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -17,4 +17,5 @@ do
done done
print_success "Documentation installed" print_success "Documentation installed"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -8,8 +8,7 @@ build_target libiso8601
if [ -z ${isodate_BUILT} ] if [ -z ${isodate_BUILT} ]
then then
isodate="obj/isodate" isodate="obj/isodate"
EXTRAS="-std=gnu99 -D_GNU_SOURCE -DAPP_NAME=\"isodate\" \ EXTRAS="${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS}"
${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS}"
echo "Building application ${isodate}..." echo "Building application ${isodate}..."
@ -40,4 +39,5 @@ then
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -8,4 +8,5 @@ echo "Installing binaries into '${BINDIR}'"
install_file "${isodate}" "${BINDIR}" 0755 || return 1 install_file "${isodate}" "${BINDIR}" 0755 || return 1
print_success "Done" print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -14,4 +14,5 @@ then
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}" MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -8,10 +8,6 @@
#ifndef HEADER_libiso8601 #ifndef HEADER_libiso8601
#define HEADER_libiso8601 #define HEADER_libiso8601
#ifdef __cplusplus
extern "C" {
#endif
/* standard includes, or includes needed for type declarations */ /* standard includes, or includes needed for type declarations */
#include <time.h> #include <time.h>
#include <stdint.h> #include <stdint.h>

View File

@ -39,8 +39,6 @@ leap_second_days_table[] = {
730119, /* 1998-12-31 */ 730119, /* 1998-12-31 */
732676, /* 2005-12-31 */ 732676, /* 2005-12-31 */
733772, /* 2008-12-31 */ 733772, /* 2008-12-31 */
735049, /* 2012-06-30 */
736144, /* 2015-06-30 */
}; };

View File

@ -58,7 +58,7 @@ enum iso8601_date_prec {
/*! \brief Year, week and weekday specified (week format). */ /*! \brief Year, week and weekday specified (week format). */
iso8601_prec_wday iso8601_prec_wday
}; }date_prec;
@ -87,7 +87,7 @@ enum iso8601_time_prec {
iso8601_prec_minfrac, iso8601_prec_minfrac,
/*! \brief Display hour, minute, second and nanoseconds. */ /*! \brief Display hour, minute, second and nanoseconds. */
iso8601_prec_secfrac iso8601_prec_secfrac
}; }time_prec;

View File

@ -22,8 +22,7 @@ iso8601_now(struct iso8601_date* date, struct iso8601_details* details)
if(use_gettimeofday || clock_gettime(CLOCK_REALTIME, &ts)) { if(use_gettimeofday || clock_gettime(CLOCK_REALTIME, &ts)) {
use_gettimeofday = 1; use_gettimeofday = 1;
gettimeofday(&tv, 0); gettimeofday(&tv, 0);
if(tv.tv_sec < 0) ts.tv_sec = 0; ts.tv_sec = tv.tv_sec;
else ts.tv_sec = tv.tv_sec;
ts.tv_nsec = tv.tv_usec * 1000L; ts.tv_nsec = tv.tv_usec * 1000L;
} }
@ -80,10 +79,6 @@ iso8601_from_ts(struct iso8601_date* date, const struct timespec* ts)
ldiv_t qr; ldiv_t qr;
qr = ldiv(ts->tv_sec, 86400); qr = ldiv(ts->tv_sec, 86400);
if(ts->tv_sec < 0) {
--qr.quot;
qr.rem += 86400;
}
date->day = EPOCH_GDAY + qr.quot; date->day = EPOCH_GDAY + qr.quot;
date->sec = qr.rem; date->sec = qr.rem;
date->nsec = ts->tv_nsec; date->nsec = ts->tv_nsec;
@ -106,10 +101,6 @@ iso8601_from_tv(struct iso8601_date* date, const struct timeval* tv)
ldiv_t qr; ldiv_t qr;
qr = ldiv(tv->tv_sec, 86400); qr = ldiv(tv->tv_sec, 86400);
if(tv->tv_sec < 0) {
--qr.quot;
qr.rem += 86400;
}
date->day = EPOCH_GDAY + qr.quot; date->day = EPOCH_GDAY + qr.quot;
date->sec = qr.rem; date->sec = qr.rem;
date->nsec = tv->tv_usec * 1000; date->nsec = tv->tv_usec * 1000;
@ -132,10 +123,6 @@ iso8601_from_time_t(struct iso8601_date* date, const time_t* t)
ldiv_t qr; ldiv_t qr;
qr = ldiv(*t, 86400); qr = ldiv(*t, 86400);
if(*t < 0) {
--qr.quot;
qr.rem += 86400;
}
date->day = EPOCH_GDAY + qr.quot; date->day = EPOCH_GDAY + qr.quot;
date->sec = qr.rem; date->sec = qr.rem;
date->nsec = 0; date->nsec = 0;

View File

@ -19,8 +19,8 @@ conversion).
/*! \brief Retrieve the current time. /*! \brief Retrieve the current time.
\param[out] date Current date/time (may be 0), in UTC. May be 0. \param[out] date Current date/time (may be 0), in UTC.
\param[out] details Details (may be 0), including timezone. May be 0. \param[out] details Details (may be 0), including timezone.
Retrieves the current time from the system clock, storing it into \a date and Retrieves the current time from the system clock, storing it into \a date and
\a details (both parameters optional). \a details (both parameters optional).

View File

@ -26,7 +26,11 @@ understood by humans, and vice versa.
Returns non-0 if \a year is a leap year. Returns non-0 if \a year is a leap year.
*/ */
int iso8601_isleap(int year); int iso8601_isleap(int year)
#ifndef DOXYGEN
__attribute__((nonnull))
#endif
;

View File

@ -124,7 +124,11 @@ be set appropriately. If \a errno is \c EINVAL, then the file does not contain
a valid leap second table. a valid leap second table.
*/ */
int iso8601_leap_table_load(const char* fname); int iso8601_leap_table_load(const char* fname)
#ifndef DOXYGEN
__attribute__((nonnull))
#endif
;

View File

@ -148,7 +148,7 @@ stored in \a sign (if it is not a null pointer), i.e. -1 if \a d2 &gt; \a d1 or
void iso8601_difference(const struct iso8601_date* d1, void iso8601_difference(const struct iso8601_date* d1,
const struct iso8601_date* d2, struct iso8601_elapsed* per, int* sign) const struct iso8601_date* d2, struct iso8601_elapsed* per, int* sign)
#ifndef DOXYGEN #ifndef DOXYGEN
__attribute__((nonnull(1,2))) __attribute__((nonnull))
#endif #endif
; ;

View File

@ -5,10 +5,6 @@
* http://www.gnu.org/copyleft/gpl.html for details. * http://www.gnu.org/copyleft/gpl.html for details.
*/ */
#ifdef __cplusplus
}
#endif
#endif #endif
/* options for text editors /* options for text editors

View File

@ -34,4 +34,5 @@ do_cmd_redir "${CONFFILE}" sed \
do_cmd chmod 0755 "${CONFFILE}" do_cmd chmod 0755 "${CONFFILE}"
print_success "Done" print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -14,9 +14,7 @@ then
libiso8601="obj/${libiso8601_BASE}.so.${SOMAJOR}.${SOMICRO}" libiso8601="obj/${libiso8601_BASE}.so.${SOMAJOR}.${SOMICRO}"
libiso8601_DEP_CFLAGS="" libiso8601_DEP_CFLAGS=""
libiso8601_DEP_LIBS="-lrt" libiso8601_DEP_LIBS="-lrt"
SO_EXTRA="${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} -lc \ SO_EXTRA="-std=gnu99 -D_GNU_SOURCE -DDEFAULT_LEAP_TABLE=\"${DEFAULT_LEAP_TABLE}\" ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} -lc"
-D_GNU_SOURCE -std=gnu99 \
-DDEFAULT_LEAP_TABLE=\"${DEFAULT_LEAP_TABLE}\""
echo "Building library ${libiso8601}..." echo "Building library ${libiso8601}..."
@ -54,4 +52,5 @@ then
libiso8601_HEADER=${HDR} libiso8601_HEADER=${HDR}
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -17,4 +17,5 @@ then
libiso8601_MONOLITHIC=1 libiso8601_MONOLITHIC=1
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}" MONOLITHIC_DOC="${MONOLITHIC_DOC} ${HDR}"
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -95,3 +95,4 @@ true
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;

View File

@ -1,8 +1,8 @@
# libiso8601/src/libiso8601/soversion # libiso8601/src/libiso8601/soversion
# #
# Copyright: ©20072011, Güralp Systems Ltd. # (c)2007, Laurence Withers, <l@lwithers.me.uk>.
# Author: Laurence Withers <lwithers@guralp.com> # Released under the GNU GPLv3. See file COPYING or
# License: GPLv3 # http://www.gnu.org/copyleft/gpl.html for details.
# #
@ -12,4 +12,4 @@
SOMAJOR=1 SOMAJOR=1
# SOMICRO is bumped every time there is a binary-compatible release. # SOMICRO is bumped every time there is a binary-compatible release.
SOMICRO=10 SOMICRO=5

View File

@ -8,8 +8,7 @@ build_target libiso8601
if [ -z ${setisodate_BUILT} ] if [ -z ${setisodate_BUILT} ]
then then
setisodate="obj/setisodate" setisodate="obj/setisodate"
EXTRAS="-std=gnu99 -D_GNU_SOURCE -DAPP_NAME=\"setisodate\" \ EXTRAS="${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS}"
${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS}"
echo "Building application ${setisodate}..." echo "Building application ${setisodate}..."
@ -40,4 +39,5 @@ then
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -8,4 +8,5 @@ echo "Installing binaries into '${SBINDIR}'"
install_file "${setisodate}" "${SBINDIR}" 0755 || return 1 install_file "${setisodate}" "${SBINDIR}" 0755 || return 1
print_success "Done" print_success "Done"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -14,4 +14,5 @@ then
MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}" MONOLITHIC_DOC="${MONOLITHIC_DOC} ${SRC}"
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -1 +1,3 @@
source src/tests/build.tests source src/tests/build.tests
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -7,7 +7,7 @@ build_target libiso8601 || return 1
if [ -z ${tests_BUILT} ] if [ -z ${tests_BUILT} ]
then then
LIBS="${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} " LIBS="${libiso8601} ${libiso8601_DEP_CFLAGS} ${libiso8601_DEP_LIBS} "
EXTRAS="-lm" EXTRAS="-D_GNU_SOURCE"
echo "Building test programs..." echo "Building test programs..."
do_cmd mkdir -p obj/tests || return 1 do_cmd mkdir -p obj/tests || return 1
@ -25,9 +25,14 @@ then
fi fi
done done
case "${TEST}" in
obj/tests/manip) TEST_EXTRAS="-lm" ;;
*) TEST_EXTRAS="" ;;
esac
if [ ${MODIFIED} -ne 0 ] if [ ${MODIFIED} -ne 0 ]
then then
do_cmd ${CC} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} || return 1 do_cmd ${CC} -Iobj ${CFLAGS} -o ${TEST} ${SRC} ${LIBS} ${EXTRAS} ${TEST_EXTRAS} || return 1
print_success "Built ${TEST}" print_success "Built ${TEST}"
else else
print_success "${TEST} is up to date" print_success "${TEST} is up to date"
@ -39,4 +44,5 @@ then
tests_BUILT=1 tests_BUILT=1
fi fi
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4 # vim: syntax=sh:expandtab:ts=4:sw=4

View File

@ -1,8 +1,8 @@
/* libiso8601/src/tests/xxx.c /* libiso8601/src/tests/???.c
* *
* Copyright: ©20072011, Güralp Systems Ltd. * (c)2007, Laurence Withers, <l@lwithers.me.uk>.
* Author: Laurence Withers <lwithers@guralp.com> * Released under the GNU GPLv3. See file COPYING or
* License: GPLv3 * http://www.gnu.org/copyleft/gpl.html for details.
*/ */
#include "iso8601.h" #include "iso8601.h"
@ -12,8 +12,7 @@
int int main(int argc, char* argv[])
main(int argc, char* argv[])
{ {
int ret = 0; int ret = 0;
@ -31,8 +30,7 @@ main(int argc, char* argv[])
return ret; return ret;
} }
/* options for text editors /* options for text editors
kate: replace-trailing-space-save true; space-indent true; tab-width 4;
vim: expandtab:ts=4:sw=4 vim: expandtab:ts=4:sw=4
*/ */

View File

@ -1,8 +1,8 @@
# libiso8601/version # libiso8601/version
# #
# Copyright: ©20072011, Güralp Systems Ltd. # (c)2007, Laurence Withers, <l@lwithers.me.uk>.
# Author: Laurence Withers <lwithers@guralp.com> # Released under the GNU GPLv3. See file COPYING or
# License: GPLv3 # http://www.gnu.org/copyleft/gpl.html for details.
# #
@ -11,6 +11,7 @@
# expected to be in 'major.minor.micro' format. # expected to be in 'major.minor.micro' format.
VERMAJOR=0 VERMAJOR=0
VERMINOR=3 VERMINOR=3
VERMICRO=15 VERMICRO=8
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: expandtab:ts=4:sw=4:syntax=sh # vim: expandtab:ts=4:sw=4:syntax=sh