mtime 1.2.2
Loading...
Searching...
No Matches
mtime_iso8601.h
1// Copyright (c) 2013-2024 MPI-M, Luis Kornblueh, Rahul Sinha and DWD, Florian Prill. All rights reserved.
2//
3// SPDX-License-Identifier: BSD-3-Clause
4//
21#ifndef _MTIME_ISO8601_H
22#define _MTIME_ISO8601_H
23
24#include <stdint.h>
25#include <stdbool.h>
26
27typedef enum
28{
29 FAILURE = 0, // String Failure.
30 DATETIME_MATCH = 1, //**DateTime** String Detected.
31 DURATION_MATCH_STD = 2, // Duration STD ISO FORM (eg. PT30M10S) String Detected.
32 DURATION_MATCH_LONG = 3 // Duration LONG FORM (eg. PT300S) String Detected.
33} ISO8601_STATUS;
34
35struct iso8601_duration
36{
37 int flag_std_form;
38 char sign;
39 int64_t year;
40 int month;
41 int day;
42 int hour;
43 int minute;
44 int second;
45 int ms;
46};
47
48struct iso8601_datetime
49{
50 /* Year can be positive or negative. */
51 char sign_of_year;
52 int64_t year;
53 int month;
54 int day;
55 int hour;
56 int minute;
57 int second;
58 int ms;
59};
60
61struct iso8601_datetime *new_iso8601_datetime(char _sign_of_year, int64_t _year, int _month, int _day, int _hour, int _minute,
62 int _second, int _ms);
63
64void deallocate_iso8601_datetime(struct iso8601_datetime *iso8601_datetimeObj);
65
66struct iso8601_duration *new_iso8601_duration(char _sign, int64_t _year, int _month, int _day, int _hour, int _minute, int _second,
67 int _ms);
68
69void deallocate_iso8601_duration(struct iso8601_duration *iso8601_durationObj);
70
71ISO8601_STATUS
72verify_string_datetime(const char *test_string, struct iso8601_datetime *dummy_isoDtObj);
73
74ISO8601_STATUS
75verify_string_duration(const char *test_string, struct iso8601_duration *dummy_isoDObj);
76
80#endif
81