[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Decimal time support in 'date'

From: za3k
Subject: Decimal time support in 'date'
Date: Thu, 12 Dec 2019 17:16:43 -0800
User-agent: Roundcube Webmail/1.3.9

I am interested in adding support for decimal time to 'date', but before I dive into writing a patch, I wanted to ask whether the patch has a chance of being accepted--this may just be too obscure.

In decimal time, 2019-12-12.75 would represent 2019-12-12T18:00:00. Decimal time in the modern era is mainly used in timekeeping (to track employee or contracting hours) and in scientific recording (to make drawing graphs easy). Astronomers use another form of decimal time on their own calendar and would not be supported.

Some planned specifics
The calculation is straightforward: Divide the number of seconds elapsed in the day by the total number of seconds in the day.

Based on my research, anyone who cares about accuracy uses standard time, so there is not an established standard on how to deal with DST changes. My plan would be to divide by the correct total number of seconds for leap seconds, and to throw an error if the locale has a DST change on the day.

The internal implementation width would be 14 digits (slightly more than nanosecond accuracy). I would follow the convention set in %N that the field truncates, rather than rounds, the decimal value. The default printed width would be 5 digits (slightly more than second accuracy).

I will not include parsing support, because of issues with rounding, and potential confusion with standard date formats.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]