2017-09-18

(sph time)

time as tai or utc nanoseconds since the unix epoch or gregorian calendar dates.

get, manipulate and convert dates and times in scheme

uses a proleptic gregorian calendar with negative years and a year 0 equivalent to 1 BCE and does not account for eventual historical errors in timekeeping. iso8601 and the gnu date utility include a year zero as well, to which the output is compatible

international atomic time is used because it does not use leap seconds. with utc it is not predictable when future leap seconds will be inserted, which makes it impossible to accurately calculate future times with utc

the implementation does not depend on other time libraries, only on a function that gives the current utc posixtime. it might contain useful examples for calendar and time calculation implementors

part of sph-lib

see also (sph time gregorian), (sph time utc), (sph time string)

library description

objects

  utc: integer: utc seconds since the unix epoch. utc uses leap seconds to conform to (= number-of-days (/ utc-seconds 86400))

  tai: integer: tai seconds since the unix epoch. as elapsed, no leap seconds

  date: vector: gregorian calendar date, daytime and timezone offset

import name

(sph time)

exports

date->week-day

procedure

signature

a ->

description

from 0-6, with monday being the first day of the week

date-add-day

procedure

signature

a ->

date-create

procedure

signature

#:year #:month #:day #:hour #:minute #:second #:nanosecond #:offset ->

description

create a date object

date-create*

procedure

signature

[year month day hour minute second nanosecond offset] ->

description

like date-create but the arguments are not keyword arguments

date-day

procedure

signature

record ->

date-hour

procedure

signature

record ->

date-minute

procedure

signature

record ->

date-month

procedure

signature

record ->

date-nanosecond

procedure

signature

record ->

date-offset

procedure

signature

record ->

date-record

variable

date-second

procedure

signature

record ->

date-week-count

procedure

signature

a ->

date-year

procedure

signature

record ->

nanoseconds->hms&

procedure

signature

a c ->

nanoseconds->seconds

procedure

signature

a ->

ns->s

procedure

signature

a ->

s->ns

procedure

signature

a ->

seconds->nanoseconds

procedure

signature

a ->

sph-time-description

variable

tai->utc

procedure

signature

a ->

integer -> integer

description

convert tai time to utc time

tai-add-minutes

procedure

signature

a minutes ->

description

add minutes to tai or utc time

tai-add-seconds

procedure

signature

a seconds ->

description

add seconds to tai or utc time

tai-current

procedure

signature

->

description

current tai seconds since the unix epoch

tai-from-utc

procedure

signature

a ->

integer -> integer

description

convert utc time to tai time

utc->date

procedure

signature

a ->

utc->days

procedure

signature

a ->

utc->hours

procedure

signature

a ->

utc->minutes

procedure

signature

a ->

utc->seconds

procedure

signature

a ->

utc->week

procedure

signature

a ->

integer -> integer

utc->week-day

procedure

signature

a ->

description

from 0-6, with monday being the first day of the week

utc->year

procedure

signature

a ->

utc->years

procedure

signature

a ->

utc-add-day

procedure

signature

a days ->

utc-add-hours

procedure

signature

a hours ->

utc-add-weeks

procedure

signature

a weeks ->

utc-add-years

procedure

signature

a years ->

utc-current

procedure

signature

->

-> integer

utc-days

procedure

signature

a ->

utc-days-and-rest&

procedure

signature

a c ->

utc-elapsed-day

procedure

signature

a ->

utc-elapsed-hour

procedure

signature

a ->

utc-elapsed-minute

procedure

signature

a ->

utc-elapsed-month

procedure

signature

a ->

utc-elapsed-year

procedure

signature

a ->

utc-from-date

procedure

signature

a ->

utc-from-days

procedure

signature

a ->

utc-from-hours

procedure

signature

a ->

utc-from-minutes

procedure

signature

a ->

utc-from-year

procedure

signature

a ->

utc-from-years

procedure

signature

a ->

utc-start-day

procedure

signature

a ->

utc-start-first-week

procedure

signature

a ->

description

iso standard first week of current year of time.

based on if thursday falls into the first week-days of the year

utc-start-hour

procedure

signature

a ->

utc-start-last-week

procedure

signature

a ->

description

the start of the last week of the year

utc-start-minute

procedure

signature

a ->

utc-start-month

procedure

signature

a ->

utc-start-second

procedure

signature

a ->

utc-start-week

procedure

signature

a ->

utc-start-year

procedure

signature

a ->

utc-year

procedure

signature

a ->

utc-zone-offset

procedure

signature

->

description

get the current local system timezone offset


tags: programming guile documentation library scheme sph-lib q1 computer time highlight sph-time