summaryrefslogtreecommitdiff
path: root/support/dktools/dk4time08.ctr
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk4time08.ctr
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk4time08.ctr')
-rw-r--r--support/dktools/dk4time08.ctr63
1 files changed, 60 insertions, 3 deletions
diff --git a/support/dktools/dk4time08.ctr b/support/dktools/dk4time08.ctr
index a85cba406e..6abffd9f12 100644
--- a/support/dktools/dk4time08.ctr
+++ b/support/dktools/dk4time08.ctr
@@ -2,7 +2,7 @@
copyright owner = Dirk Krause
copyright year = 2015-xxxx
-license = bsd
+SPDX-License-Identifier: BSD-3-Clause
%% header
@@ -16,23 +16,43 @@ license = bsd
*/
#ifndef DK4CONF_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
+#else
+#include <dktools-4/dk4conf.h>
+#endif
#endif
#ifndef DK4TYPES_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4types.h"
+#else
+#include <dktools-4/dk4types.h>
+#endif
#endif
#ifndef DK4ERROR_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4error.h"
+#else
+#include <dktools-4/dk4error.h>
+#endif
#endif
#ifndef DK4TIME_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4time.h"
+#else
+#include <dktools-4/dk4time.h>
+#endif
#endif
#ifndef DK4TIMEC_H_INCLUDED
+#if DK4_BUILDING_DKTOOLS4
#include "dk4timec.h"
+#else
+#include <dktools-4/dk4timec.h>
+#endif
#endif
#ifdef __cplusplus
@@ -130,6 +150,15 @@ dk4time_as_text_c8(
%% module
+#include "dk4conf.h"
+
+#if DK4_HAVE_ASSERT_H
+#ifndef ASSERT_H_INCLUDED
+#include <assert.h>
+#define ASSERT_H_INCLUDED 1
+#endif
+#endif
+
#include "dk4time08.h"
#ifndef DK4STR8_H_INCLUDED
@@ -183,6 +212,10 @@ dk4time_to_text_c8(
char bse[8];
int res;
int back = 0;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(0 < dsz);
+#endif
if ((NULL != dptr) && (0 < dsz)) {
back = 1;
res = dk4ma_write_c8_decimal_unsigned(
@@ -290,13 +323,22 @@ dk4time_convert_to_text_c8(
)
{
int back = 0;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(0 < dsz);
+ assert(NULL != tm);
+#endif
if ((NULL != dptr) && (0 < dsz)) {
*dptr = '\0';
if (NULL != tm) {
back = dk4time_to_text_c8(
dptr, dsz, DK4_TIMEFORMAT_DATE_TIME,
- (1900 + tm->tm_year), (1 + tm->tm_mon), tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec,
+ (unsigned short)(1900 + tm->tm_year),
+ (unsigned short)(1 + tm->tm_mon),
+ (unsigned short)(tm->tm_mday),
+ (unsigned short)(tm->tm_hour),
+ (unsigned short)(tm->tm_min),
+ (unsigned short)(tm->tm_sec),
erp
);
} else {
@@ -320,6 +362,11 @@ dk4time_i_as_text_c8(
/* +++ Windows */
struct tm lct;
int back = 0;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(0 < dsz);
+ assert(NULL != timer);
+#endif
if (0 == _localtime64_s(&lct, timer)) {
back = dk4time_convert_to_text_c8(dptr, dsz, &lct, erp);
} else {
@@ -332,6 +379,11 @@ dk4time_i_as_text_c8(
#if DK4_HAVE_LOCALTIME_R
struct tm lct;
int back = 0;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(0 < dsz);
+ assert(NULL != timer);
+#endif
if (NULL != localtime_r(timer, &lct)) {
back = dk4time_convert_to_text_c8(dptr, dsz, &lct, erp);
} else {
@@ -354,6 +406,11 @@ dk4time_as_text_c8(
)
{
int back = 0;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(0 < dsz);
+ assert(NULL != timer);
+#endif
if ((NULL != dptr) && (0 < dsz)) {
*dptr = '\0';
if (NULL != timer) {