Next: , Previous: , Up: Time   [Index]


I.2.4 Time Calculations

These functions perform calendrical computations using time values. A value of ‘nil’ for any of their time-value arguments stands for the current system time, and a single number stands for the number of seconds since the epoch.

time-less-p T1 T2

This returns ‘t’ if time value ‘T1’ is less than time value ‘T2’. The result is ‘nil’ if either argument is a ‘NaN’.

time-equal-p T1 T2

This returns ‘t’ if ‘T1’ and ‘T2’ are equal time values. The result is ‘nil’ if either argument is a ‘NaN’.

time-subtract T1 T2

This returns the time difference ‘T1’ - ‘T2’ between two time values, as a Lisp time value. If you need the difference in units of elapsed seconds, you can convert it with time-convert or float-time.

time-add T1 T2

This returns the sum of two time values, using the same conversion rules as time-subtract. One argument should represent a time difference rather than a point in time, as a time value that is often just a single number of elapsed seconds.

(time-add time seconds)

time-to-days TIME-VALUE

This function returns the number of days between the beginning of year 1 and time-value, assuming the default time zone.

time-to-day-in-year TIME-VALUE

This returns the day number within the year corresponding to ‘time-value’, assuming the default time zone.

date-leap-year-p YEAR

This function returns ‘t’ if year is a leap year.

date-days-in-month YEAR MONTH

Return the number of days in month in year. For instance, February 2020 has 29 days.

date-ordinal-to-time YEAR ORDINAL

Return the date of ‘ORDINAL’ in year as a decoded time structure. For instance, the 120th day in 2004 is April 29th.


Next: Timers, Previous: Time Parsing, Up: Time   [Index]