/*
- * dtime.c -- time/date routines
- *
- * This code is Copyright (c) 2002, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** dtime.c -- time/date routines
+**
+** This code is Copyright (c) 2002, by the authors of nmh. See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
#include <h/mh.h> /* for snprintf() */
#include <h/nmh.h>
#endif
/*
- * The number of days in the year, accounting for leap years
- */
+** The number of days in the year, accounting for leap years
+*/
#define dysize(y) \
(((y) % 4) ? 365 : (((y) % 100) ? 366 : (((y) % 400) ? 365 : 366)))
/*
- * Get current time (adjusted for local time
- * zone and daylight savings time) expressed
- * as nmh "broken-down" time structure.
- */
+** Get current time (adjusted for local time
+** zone and daylight savings time) expressed
+** as nmh "broken-down" time structure.
+*/
struct tws *
dlocaltimenow (void)
/*
- * Take clock value and return pointer to nmh time structure
- * containing "broken-down" time. The time is adjusted for
- * local time zone and daylight savings time.
- */
+** Take clock value and return pointer to nmh time structure
+** containing "broken-down" time. The time is adjusted for
+** local time zone and daylight savings time.
+*/
struct tws *
dlocaltime (time_t *clock)
/*
- * Take clock value and return pointer to nmh time
- * structure containing "broken-down" time. Time is
- * expressed in UTC (Coordinated Universal Time).
- */
+** Take clock value and return pointer to nmh time
+** structure containing "broken-down" time. Time is
+** expressed in UTC (Coordinated Universal Time).
+*/
struct tws *
dgmtime (time_t *clock)
/*
- * Using a nmh "broken-down" time structure,
- * produce a 26-byte date/time string, such as
- *
- * Tue Jan 14 17:49:03 1992\n\0
- */
+** Using a nmh "broken-down" time structure,
+** produce a 26-byte date/time string, such as
+**
+** Tue Jan 14 17:49:03 1992\n\0
+*/
char *
dctime (struct tws *tw)
/*
- * Produce a date/time string of the form
- *
- * Mon, 16 Jun 1992 15:30:48 -700 (or)
- * Mon, 16 Jun 1992 15:30:48 EDT
- *
- * for the current time, as specified by rfc822.
- * The first form is required by rfc1123.
- */
+** Produce a date/time string of the form
+**
+** Mon, 16 Jun 1992 15:30:48 -700 (or)
+** Mon, 16 Jun 1992 15:30:48 EDT
+**
+** for the current time, as specified by rfc822.
+** The first form is required by rfc1123.
+*/
char *
dtimenow (int alpha_timezone)
/*
- * Using a local calendar time value, produce
- * a date/time string of the form
- *
- * Mon, 16 Jun 1992 15:30:48 -700 (or)
- * Mon, 16 Jun 1992 15:30:48 EDT
- *
- * as specified by rfc822. The first form is required
- * by rfc1123 for outgoing messages.
- */
+** Using a local calendar time value, produce
+** a date/time string of the form
+**
+** Mon, 16 Jun 1992 15:30:48 -700 (or)
+** Mon, 16 Jun 1992 15:30:48 EDT
+**
+** as specified by rfc822. The first form is required
+** by rfc1123 for outgoing messages.
+*/
char *
dtime (time_t *clock, int alpha_timezone)
/*
- * Using a nmh "broken-down" time structure, produce
- * a date/time string of the form
- *
- * Mon, 16 Jun 1992 15:30:48 -0700
- *
- * as specified by rfc822 and rfc1123.
- */
+** Using a nmh "broken-down" time structure, produce
+** a date/time string of the form
+**
+** Mon, 16 Jun 1992 15:30:48 -0700
+**
+** as specified by rfc822 and rfc1123.
+*/
char *
dasctime (struct tws *tw, int flags)
/*
- * Get the timezone for given offset
- */
+** Get the timezone for given offset
+*/
char *
dtimezone (int offset, int flags)
/*
- * Convert nmh time structure for local "broken-down"
- * time to calendar time (clock value). This routine
- * is based on the gtime() routine written by Steven Shafer
- * at CMU. It was forwarded to MTR by Jay Lepreau at Utah-CS.
- */
+** Convert nmh time structure for local "broken-down"
+** time to calendar time (clock value). This routine
+** is based on the gtime() routine written by Steven Shafer
+** at CMU. It was forwarded to MTR by Jay Lepreau at Utah-CS.
+*/
time_t
dmktime (struct tws *tw)
/*
- * Simple calculation of day of the week. Algorithm
- * used is Zeller's congruence. We assume that
- * if tw->tw_year < 100, then the century = 19.
- */
+** Simple calculation of day of the week. Algorithm
+** used is Zeller's congruence. We assume that
+** if tw->tw_year < 100, then the century = 19.
+*/
void
set_dotw (struct tws *tw)
/*
- * Copy nmh time structure
- */
+** Copy nmh time structure
+*/
void
twscopy (struct tws *tb, struct tws *tw)
/*
- * Compare two nmh time structures
- */
+** Compare two nmh time structures
+*/
int
twsort (struct tws *tw1, struct tws *tw2)