+++ /dev/null
-// SPDX-FileCopyrightText: 2025, Alejandro Colomar <alx@kernel.org>
-// SPDX-FileCopyrightText: 2025, "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#include <config.h>
-
-#include <stddef.h>
-#include <time.h>
-
-#include "getdate.h"
-#include "string/strcmp/streq.h"
-
-
-time_t
-get_date(const char *s)
-{
- time_t t;
- struct tm tm;
- const char *p;
-
- t = 0;
- if (gmtime_r(&t, &tm) == NULL)
- return -1;
-
- p = strptime(s, "%Y-%m-%d", &tm);
- if (p == NULL || !streq(p, ""))
- return -1;
-
- return timegm(&tm);
-}
+++ /dev/null
-/*
- * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1997 - 2000, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef _GETDATE_H_
-#define _GETDATE_H_
-
-#include <config.h>
-#include "defines.h"
-
-time_t get_date(const char *s);
-#endif
-/*
- * SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1996 - 1999, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
- * SPDX-FileCopyrightText: 2008 , Nicolas François
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
+// SPDX-FileCopyrightText: 1991-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1999, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008, Nicolas François
+// SPDX-FileCopyrightText: 2025, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2025, "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
+// SPDX-License-Identifier: BSD-3-Clause
+
#include <config.h>
-#include <ctype.h>
+#include <stddef.h>
+#include <time.h>
#include "atoi/str2i.h"
-#include "getdate.h"
+#include "defines.h"
#include "prototypes.h"
#include "string/strcmp/streq.h"
+static time_t get_date(const char *s);
+
+
// string parse-to day-since-Epoch
long
strtoday(const char *str)
}
return t / DAY;
}
+
+
+static time_t
+get_date(const char *s)
+{
+ time_t t;
+ struct tm tm;
+ const char *p;
+
+ t = 0;
+ if (gmtime_r(&t, &tm) == NULL)
+ return -1;
+
+ p = strptime(s, "%Y-%m-%d", &tm);
+ if (p == NULL || !streq(p, ""))
+ return -1;
+
+ return timegm(&tm);
+}