Changeset 35736 in project


Ignore:
Timestamp:
07/04/18 18:34:23 (3 months ago)
Author:
kon
Message:

add date->seconds + simple test, add mod jul -> time, reflow, rel 3.7.0

Location:
release/4/srfi-19
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/srfi-19/tags/3.7.0/srfi-19-date.scm

    r35402 r35736  
    8686  date-dst?
    8787  copy-date
     88  date->seconds
    8889  date->time
    8990  date-adjust
     
    224225    (tm:seconds->date/type (check-raw-seconds 'seconds->date sec) tzc) ) )
    225226
    226 (define seconds->date/type seconds->date) ;DEPRECATED
     227(define (date->seconds dat #!optional (tt (default-date-clock-type)))
     228  (let* (
     229    (dat (check-date 'date->seconds dat))
     230    (tim
     231      (case (check-clock-type 'date->seconds tt)
     232        ((utc)        (tm:date->time-utc dat))
     233        ((tai)        (tm:date->time-tai dat))
     234        ((monotonic)  (tm:date->time-monotonic dat)) ) ) )
     235    (tm:time-second tim) ) )
    227236
    228237(define (current-date . tzi)
     
    466475
    467476(define (natural-year n . tzi)
    468   (tm:natural-year (check-date-year 'natural-year n) (checked-optional-timezone-info 'natural-year (optional tzi #t))) )
     477  (tm:natural-year
     478    (check-date-year 'natural-year n)
     479    (checked-optional-timezone-info 'natural-year (optional tzi #t))) )
    469480
    470481;; Leap Year
     
    563574
    564575(define (modified-julian-day->time-utc mjdn)
    565   (tm:julian-day->time-utc
    566     (tm:modified-julian-day->julian-day
    567       (check-julian-day 'modified-julian-day->time-utc mjdn))) )
     576  (tm:modified-julian-day->time-utc
     577    (check-julian-day 'modified-julian-day->time-utc mjdn)) )
    568578
    569579(define (modified-julian-day->time-tai mjdn)
    570   (let ((tim
    571           (tm:julian-day->time-utc
    572             (tm:modified-julian-day->julian-day
    573               (check-julian-day 'modified-julian-day->time-tai mjdn)))))
     580  (let (
     581    (tim
     582      (tm:modified-julian-day->time-utc
     583        (check-julian-day 'modified-julian-day->time-tai mjdn))) )
    574584    (tm:time-utc->time-tai tim tim) ) )
    575585
    576586(define (modified-julian-day->time-monotonic mjdn)
    577   (let ((tim
    578           (tm:julian-day->time-utc
    579             (tm:modified-julian-day->julian-day
    580               (check-julian-day 'modified-julian-day->time-monotonic mjdn)))))
     587  (let (
     588    (tim
     589      (tm:modified-julian-day->time-utc
     590        (check-julian-day 'modified-julian-day->time-monotonic mjdn))) )
    581591    (tm:time-utc->time-monotonic tim tim) ) )
    582592
    583593(define (modified-julian-day->date mjdn . tzi)
    584594  (tm:time-utc->date
    585     (tm:julian-day->time-utc
    586       (tm:modified-julian-day->julian-day
    587         (check-julian-day 'modified-julian-day->date mjdn)))
     595    (tm:modified-julian-day->time-utc
     596      (check-julian-day 'modified-julian-day->date mjdn))
    588597    (checked-optional-timezone-info 'modified-julian-day->date (optional tzi #t))) )
    589598
     
    637646    (list-index (cut eq? b <>) +date-key-lexographic-order+)) )
    638647
     648;DEPRECATED
     649
     650(: seconds->date/type deprecated)
     651(define seconds->date/type seconds->date)
     652
    639653) ;module srfi-19-date
  • release/4/srfi-19/tags/3.7.0/srfi-19-support.scm

    r35402 r35736  
    254254  tm:modified-julian-day->julian-day
    255255  tm:julian-day->time-utc
     256  tm:modified-julian-day->time-utc
    256257  tm:default-date-adjust-integer)
    257258
     
    18681869          (tm:make-time 'time-utc ns sec) ) ) ) ) )
    18691870
     1871(define (tm:modified-julian-day->time-utc mjdn)
     1872  (tm:julian-day->time-utc (tm:modified-julian-day->julian-day mjdn)) )
     1873
    18701874(define (tm:default-date-adjust-integer amt)
    18711875  (round amt) )
  • release/4/srfi-19/tags/3.7.0/srfi-19.scm

    r34839 r35736  
    126126  copy-date
    127127  date->time
     128  date->seconds
    128129  date-adjust
    129130  date-difference
  • release/4/srfi-19/tags/3.7.0/srfi-19.setup

    r35402 r35736  
    1212(install-srfi-29-bundle 'srfi-19 'pt 'br)
    1313
    14 (setup-shared-extension-module 'srfi-19-timezone (extension-version "3.6.0")
     14(setup-shared-extension-module 'srfi-19-timezone (extension-version "3.7.0")
    1515        #:inline? #t
    1616        #:types? #t
    1717  #:compile-options '(-fixnum-arithmetic -optimize-level 3 -no-procedure-checks))
    1818
    19 (setup-shared-extension-module 'srfi-19-support (extension-version "3.6.0")
     19(setup-shared-extension-module 'srfi-19-support (extension-version "3.7.0")
    2020        #:inline? #t
    2121        #:types? #t
     
    2424    -no-procedure-checks -no-bound-checks -no-argc-checks))
    2525
    26 (setup-shared-extension-module 'srfi-19-time (extension-version "3.6.0")
     26(setup-shared-extension-module 'srfi-19-time (extension-version "3.7.0")
    2727        #:inline? #t
    2828        #:types? #t
    2929  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    3030
    31 (setup-shared-extension-module 'srfi-19-date (extension-version "3.6.0")
     31(setup-shared-extension-module 'srfi-19-date (extension-version "3.7.0")
    3232        #:inline? #t
    3333        #:types? #t
    3434  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    3535
    36 (setup-shared-extension-module 'srfi-19-io (extension-version "3.6.0")
     36(setup-shared-extension-module 'srfi-19-io (extension-version "3.7.0")
    3737        #:inline? #t
    3838        #:types? #t
    3939  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    4040
    41 (setup-shared-extension-module 'srfi-19-period (extension-version "3.6.0")
     41(setup-shared-extension-module 'srfi-19-period (extension-version "3.7.0")
    4242        #:inline? #t
    4343        #:types? #t
    4444  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    4545
    46 (setup-shared-extension-module 'srfi-19-core (extension-version "3.6.0")
     46(setup-shared-extension-module 'srfi-19-core (extension-version "3.7.0")
    4747        #:inline? #t
    4848        #:types? #t
    4949  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    5050
    51 (setup-shared-extension-module 'srfi-19 (extension-version "3.6.0")
     51(setup-shared-extension-module 'srfi-19 (extension-version "3.7.0")
    5252        #:inline? #t
    5353        #:types? #t
  • release/4/srfi-19/tags/3.7.0/tests/srfi-19-test.scm

    r34836 r35736  
    450450        (time=? tim (srfi-18-time->time (time->srfi-18-time tim))) ) ) ) )
    451451
     452(define-s19-test! "seconds 0 <-> date"
     453  (lambda ()
     454    (= 0 (date->seconds (seconds->date 0))) ) )
     455
    452456; Duration
    453457; Time Aritmetic (+ - * /)
  • release/4/srfi-19/trunk/srfi-19-date.scm

    r35402 r35736  
    8686  date-dst?
    8787  copy-date
     88  date->seconds
    8889  date->time
    8990  date-adjust
     
    224225    (tm:seconds->date/type (check-raw-seconds 'seconds->date sec) tzc) ) )
    225226
    226 (define seconds->date/type seconds->date) ;DEPRECATED
     227(define (date->seconds dat #!optional (tt (default-date-clock-type)))
     228  (let* (
     229    (dat (check-date 'date->seconds dat))
     230    (tim
     231      (case (check-clock-type 'date->seconds tt)
     232        ((utc)        (tm:date->time-utc dat))
     233        ((tai)        (tm:date->time-tai dat))
     234        ((monotonic)  (tm:date->time-monotonic dat)) ) ) )
     235    (tm:time-second tim) ) )
    227236
    228237(define (current-date . tzi)
     
    466475
    467476(define (natural-year n . tzi)
    468   (tm:natural-year (check-date-year 'natural-year n) (checked-optional-timezone-info 'natural-year (optional tzi #t))) )
     477  (tm:natural-year
     478    (check-date-year 'natural-year n)
     479    (checked-optional-timezone-info 'natural-year (optional tzi #t))) )
    469480
    470481;; Leap Year
     
    563574
    564575(define (modified-julian-day->time-utc mjdn)
    565   (tm:julian-day->time-utc
    566     (tm:modified-julian-day->julian-day
    567       (check-julian-day 'modified-julian-day->time-utc mjdn))) )
     576  (tm:modified-julian-day->time-utc
     577    (check-julian-day 'modified-julian-day->time-utc mjdn)) )
    568578
    569579(define (modified-julian-day->time-tai mjdn)
    570   (let ((tim
    571           (tm:julian-day->time-utc
    572             (tm:modified-julian-day->julian-day
    573               (check-julian-day 'modified-julian-day->time-tai mjdn)))))
     580  (let (
     581    (tim
     582      (tm:modified-julian-day->time-utc
     583        (check-julian-day 'modified-julian-day->time-tai mjdn))) )
    574584    (tm:time-utc->time-tai tim tim) ) )
    575585
    576586(define (modified-julian-day->time-monotonic mjdn)
    577   (let ((tim
    578           (tm:julian-day->time-utc
    579             (tm:modified-julian-day->julian-day
    580               (check-julian-day 'modified-julian-day->time-monotonic mjdn)))))
     587  (let (
     588    (tim
     589      (tm:modified-julian-day->time-utc
     590        (check-julian-day 'modified-julian-day->time-monotonic mjdn))) )
    581591    (tm:time-utc->time-monotonic tim tim) ) )
    582592
    583593(define (modified-julian-day->date mjdn . tzi)
    584594  (tm:time-utc->date
    585     (tm:julian-day->time-utc
    586       (tm:modified-julian-day->julian-day
    587         (check-julian-day 'modified-julian-day->date mjdn)))
     595    (tm:modified-julian-day->time-utc
     596      (check-julian-day 'modified-julian-day->date mjdn))
    588597    (checked-optional-timezone-info 'modified-julian-day->date (optional tzi #t))) )
    589598
     
    637646    (list-index (cut eq? b <>) +date-key-lexographic-order+)) )
    638647
     648;DEPRECATED
     649
     650(: seconds->date/type deprecated)
     651(define seconds->date/type seconds->date)
     652
    639653) ;module srfi-19-date
  • release/4/srfi-19/trunk/srfi-19-support.scm

    r35402 r35736  
    254254  tm:modified-julian-day->julian-day
    255255  tm:julian-day->time-utc
     256  tm:modified-julian-day->time-utc
    256257  tm:default-date-adjust-integer)
    257258
     
    18681869          (tm:make-time 'time-utc ns sec) ) ) ) ) )
    18691870
     1871(define (tm:modified-julian-day->time-utc mjdn)
     1872  (tm:julian-day->time-utc (tm:modified-julian-day->julian-day mjdn)) )
     1873
    18701874(define (tm:default-date-adjust-integer amt)
    18711875  (round amt) )
  • release/4/srfi-19/trunk/srfi-19.scm

    r34839 r35736  
    126126  copy-date
    127127  date->time
     128  date->seconds
    128129  date-adjust
    129130  date-difference
  • release/4/srfi-19/trunk/srfi-19.setup

    r35402 r35736  
    1212(install-srfi-29-bundle 'srfi-19 'pt 'br)
    1313
    14 (setup-shared-extension-module 'srfi-19-timezone (extension-version "3.6.0")
     14(setup-shared-extension-module 'srfi-19-timezone (extension-version "3.7.0")
    1515        #:inline? #t
    1616        #:types? #t
    1717  #:compile-options '(-fixnum-arithmetic -optimize-level 3 -no-procedure-checks))
    1818
    19 (setup-shared-extension-module 'srfi-19-support (extension-version "3.6.0")
     19(setup-shared-extension-module 'srfi-19-support (extension-version "3.7.0")
    2020        #:inline? #t
    2121        #:types? #t
     
    2424    -no-procedure-checks -no-bound-checks -no-argc-checks))
    2525
    26 (setup-shared-extension-module 'srfi-19-time (extension-version "3.6.0")
     26(setup-shared-extension-module 'srfi-19-time (extension-version "3.7.0")
    2727        #:inline? #t
    2828        #:types? #t
    2929  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    3030
    31 (setup-shared-extension-module 'srfi-19-date (extension-version "3.6.0")
     31(setup-shared-extension-module 'srfi-19-date (extension-version "3.7.0")
    3232        #:inline? #t
    3333        #:types? #t
    3434  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    3535
    36 (setup-shared-extension-module 'srfi-19-io (extension-version "3.6.0")
     36(setup-shared-extension-module 'srfi-19-io (extension-version "3.7.0")
    3737        #:inline? #t
    3838        #:types? #t
    3939  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    4040
    41 (setup-shared-extension-module 'srfi-19-period (extension-version "3.6.0")
     41(setup-shared-extension-module 'srfi-19-period (extension-version "3.7.0")
    4242        #:inline? #t
    4343        #:types? #t
    4444  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    4545
    46 (setup-shared-extension-module 'srfi-19-core (extension-version "3.6.0")
     46(setup-shared-extension-module 'srfi-19-core (extension-version "3.7.0")
    4747        #:inline? #t
    4848        #:types? #t
    4949  #:compile-options '(-optimize-level 3 -no-procedure-checks))
    5050
    51 (setup-shared-extension-module 'srfi-19 (extension-version "3.6.0")
     51(setup-shared-extension-module 'srfi-19 (extension-version "3.7.0")
    5252        #:inline? #t
    5353        #:types? #t
  • release/4/srfi-19/trunk/tests/srfi-19-test.scm

    r34836 r35736  
    450450        (time=? tim (srfi-18-time->time (time->srfi-18-time tim))) ) ) ) )
    451451
     452(define-s19-test! "seconds 0 <-> date"
     453  (lambda ()
     454    (= 0 (date->seconds (seconds->date 0))) ) )
     455
    452456; Duration
    453457; Time Aritmetic (+ - * /)
Note: See TracChangeset for help on using the changeset viewer.