Changeset 15789 in project


Ignore:
Timestamp:
09/08/09 05:31:33 (10 years ago)
Author:
Kon Lovett
Message:

Rel 3.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/srfi-19

    r15736 r15789  
    1414
    1515=== Core Procedures
     16
     17The ''core'' procedures are those pertaining to time, date, and timezone:
    1618
    1719<enscript language=scheme>
     
    1921</enscript>
    2022
     23The ''core'' procedures can be separately accessed:
     24
     25<enscript language=scheme>
     26(require-extension srfi-19-time)
     27</enscript>
     28<enscript language=scheme>
     29(require-extension srfi-19-date)
     30</enscript>
     31<enscript language=scheme>
     32(require-extension srfi-19-timezone)
     33</enscript>
     34
    2135==== SRFI-19 Document Changes
    2236
     
    5973==== SRFI-18 Time
    6074
    61 Due to conflicts between SRFI-18 and SRFI-19 procedure variables
    62 {{srfi-19:current-time}} is a synonym for {{current-time}} and
    63 {{srfi-19:time?}} is a synonym for {{time?}}.
     75Note that the '''SRFI 18''' identifiers {{time?}}, {{current-time}},
     76{{seconds->time}}, {{time->seconds}}, {{milliseconds->time}}, and
     77{{time->milliseconds}} are in conflict with those of '''SRFI 19'''.
    6478
    6579===== time->srfi-18-time
    6680
    67 <procedure>(time->srfi-18-time TIME)</procedure>
     81<procedure>(time->srfi-18-time TIME) => SRFI-18:TIME</procedure>
    6882
    6983Converts a SRFI-19 time object to a SRFI-18 time object. The conversion is
    70 really only meaningful for time-duration, but any time-type is accepted.
     84really only meaningful for {{time-duration}}, but any time-type is accepted.
    7185
    7286===== srfi-18-time->time
    7387
    74 <procedure>(srfi-18-time->time TIME)</procedure>
    75 
    76 Converts a SRFI-18 time object into a SRFI-19 time-duration object.
     88<procedure>(srfi-18-time->time  => SRFI-18:TIME) => SRFI-19:TIME</procedure>
     89
     90Converts a SRFI-18 time object into a SRFI-19 {{time-duration}} object.
    7791
    7892==== Time Conversion
    7993
    80 ===== seconds->time/type
    81 
    82 <procedure>(seconds->time/type SECONDS [TIME-TYPE time-duration])</procedure>
     94===== seconds->time
     95
     96<procedure>(seconds->time SECONDS [TIME-TYPE time-duration])</procedure>
    8397
    8498Converts a {{SECONDS}} value, may be fractional, into a {{TIME-TYPE}} time
    8599object.
    86100
    87 ===== seconds->date/type
    88 
    89 <procedure>(seconds->date/type SECONDS [TIMEZONE-INFO #f])</procedure>
     101Also known as {{seconds->time/type}}.
     102
     103===== seconds->date
     104
     105<procedure>(seconds->date SECONDS [TIMEZONE-INFO #f])</procedure>
    90106
    91107Converts a {{SECONDS}} value, which may be fractional, into a date object. The
     
    95111{{SECONDS}} is relative to 00:00:00 January 1, 1970 UTC.
    96112
     113Also known as {{seconds->date/type}}.
     114
    97115===== time->nanoseconds
    98116
     
    386404Returns the timezone-locale daylight saving time flag of the supplied
    387405{{TZ-COMPONENTS}}, or the {{(local-timezone-locale)}} if missing.
    388 
    389 === Time Period
    390 
    391 <enscript language=scheme>
    392 (require-extension srfi-19-period)
    393 </enscript>
    394 
    395 A time-period is an interval, [begin end), where begin and end are time objects
    396 of the same clock type. When end <= begin the interval is null.
    397 
    398 ===== make-null-time-period
    399 
    400 <procedure>(make-null-time-period [CLOCK-TYPE (default-date-clock-type)])</procedure>
    401 
    402 Returns a null interval for the specified {{CLOCK-TYPE}}.
    403 
    404 ===== make-time-period
    405 
    406 <procedure>(make-time-period BEGIN END [CLOCK-TYPE (default-date-clock-type)])</procedure>
    407 
    408 Returns a new time-period object. The clock types must be compatible.
    409 
    410 {{BEGIN}} maybe a seconds value, a date, or a time (except time-duration). A
    411 seconds value or date are converted to {{CLOCK-TYPE}}.
    412 
    413 {{END}} maybe a seconds value, a date, or a time. A seconds value or date are
    414 converted to the same clock type as {{BEGIN}}. A time-duration is treated as an
    415 offset from {{BEGIN}}.
    416 
    417 ===== copy-time-period
    418 
    419 <procedure>(copy-time-period TIME-PERIOD)</procedure>
    420 
    421 Returns a copy of {{TIME-PERIOD}}.
    422 
    423 ===== time-period-begin
    424 
    425 <procedure>(time-period-begin TIME-PERIOD)</procedure>
    426 
    427 Returns the start time for the {{TIME-PERIOD}}.
    428 
    429 ===== time-period-end
    430 
    431 <procedure>(time-period-end TIME-PERIOD)</procedure>
    432 
    433 Returns the end time for the {{TIME-PERIOD}}.
    434 
    435 ===== time-period-last
    436 
    437 <procedure>(time-period-last TIME-PERIOD)</procedure>
    438 
    439 Returns the last time for the {{TIME-PERIOD}}; (time-period-end - 1ns).
    440 
    441 ===== time-period-type
    442 
    443 <procedure>(time-period-type TIME-PERIOD)</procedure>
    444 
    445 Returns the clock-type of the {{TIME-PERIOD}}.
    446 
    447 ===== time-period?
    448 
    449 <procedure>(time-period? OBJECT)</procedure>
    450 
    451 Is {{OBJECT}} a time-period?
    452 
    453 ===== time-period-null?
    454 
    455 <procedure>(time-period-null? TIME-PERIOD)</procedure>
    456 
    457 Is the {{TIME-PERIOD}} null?
    458 
    459 ===== time-period-length
    460 
    461 <procedure>(time-period-length TIME-PERIOD)</procedure>
    462 
    463 Returns the time-duration of the {{TIME-PERIOD}}.
    464 
    465 ===== time-period-compare
    466 
    467 <procedure>(time-period-compare TIME-PERIOD-1 TIME-PERIOD-2) => INTEGER</procedure>
    468 
    469 Returns {{-1}} when {{TIME-PERIOD-1}} < {{TIME-PERIOD-2}}, {{0}} when
    470 {{TIME-PERIOD-1}} = {{TIME-PERIOD-2}} and {{1}} {{TIME-PERIOD-1}} >
    471 {{TIME-PERIOD-2}}.
    472 
    473 ===== time-period=?
    474 
    475 <procedure>(time-period=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    476 
    477 Does {{TIME-PERIOD-1}} begin & end with {{TIME-PERIOD-2}}?
    478 
    479 ===== time-period<?
    480 
    481 <procedure>(time-period<? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    482 
    483 Does {{TIME-PERIOD-1}} end before {{TIME-PERIOD-2}} begins?
    484 
    485 ===== time-period>?
    486 
    487 <procedure>(time-period>? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    488 
    489 Does {{TIME-PERIOD-1}} begin after {{TIME-PERIOD-2}} ends?
    490 
    491 ===== time-period<=?
    492 
    493 <procedure>(time-period<=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    494 
    495 Does {{TIME-PERIOD-1}} end on or before {{TIME-PERIOD-2}} begins?
    496 
    497 ===== time-period>=?
    498 
    499 <procedure>(time-period>=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    500 
    501 Does {{TIME-PERIOD-1}} begin on or after {{TIME-PERIOD-2}} ends?
    502 
    503 ===== time-period-preceding
    504 
    505 <procedure>(time-period-preceding TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    506 
    507 Return the portion of {{TIME-PERIOD-1}} before {{TIME-PERIOD-2}} or {{#f}} when
    508 it doesn't precede.
    509 
    510 ===== time-period-succeeding
    511 
    512 <procedure>(time-period-succeeding TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    513 
    514 Return the portion of {{TIME-PERIOD-1}} after {{TIME-PERIOD-2}} or {{#f}} when
    515 it doesn't succeed.
    516 
    517 ===== time-period-contains/period?
    518 
    519 <procedure>(time-period-contains/period? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    520 
    521 Is {{TIME-PERIOD-2}} within {{TIME-PERIOD-1}}?
    522 
    523 ===== time-period-contains/time?
    524 
    525 <procedure>(time-period-contains/time? TIME-PERIOD TIME)</procedure>
    526 
    527 Is {{TIME}} within {{TIME-PERIOD}}?
    528 
    529 {{TIME}} is converted to a compatible clock-type if possible.
    530 
    531 ===== time-period-contains/date?
    532 
    533 <procedure>(time-period-contains/date? TIME-PERIOD DATE)</procedure>
    534 
    535 Is {{DATE}} within {{TIME-PERIOD}}?
    536 
    537 {{DATE}} is converted to a compatible time if possible.
    538 
    539 ===== time-period-contains?
    540 
    541 <procedure>(time-period-contains? TIME-PERIOD OBJECT)</procedure>
    542 
    543 Is {{OBJECT}} within {{TIME-PERIOD}}?
    544 
    545 {{OBJECT}} maybe a time, date, or time-period.
    546 
    547 ===== time-period-intersects?
    548 
    549 <procedure>(time-period-intersects? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    550 
    551 Does {{TIME-PERIOD-2}} overlap {{TIME-PERIOD-1}}?
    552 
    553 ===== time-period-intersection
    554 
    555 <procedure>(time-period-intersection TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    556 
    557 The overlapping time-period of {{TIME-PERIOD-2}} and {{TIME-PERIOD-1}}, or
    558 {{#f}} when no overlap.
    559 
    560 ===== time-period-union
    561 
    562 <procedure>(time-period-union TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    563 
    564 Returns the time-period spanned by {{TIME-PERIOD-1}} and {{TIME-PERIOD-2}}, or
    565 {{#f}} when they do not intersect.
    566 
    567 ===== time-period-span
    568 
    569 <procedure>(time-period-span TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
    570 
    571 Returns the time-period spanned by {{TIME-PERIOD-1}} and {{TIME-PERIOD-2}},
    572 including any gaps.
    573 
    574 ===== time-period-shift
    575 
    576 <procedure>(time-period-shift TIME-PERIOD DURATION)</procedure>
    577 
    578 Returns a copy of {{TIME-PERIOD}} shifted by {{DURATION}}.
    579 
    580 ===== time-period-shift!
    581 
    582 <procedure>(time-period-shift! TIME-PERIOD DURATION)</procedure>
    583 
    584 Returns {{TIME-PERIOD}} shifted by {{DURATION}}.
    585406
    586407=== Input/Output Procedures
     
    624445
    625446When the source is string it should be a date text form.
     447
     448=== Time Period
     449
     450<enscript language=scheme>
     451(require-extension srfi-19-period)
     452</enscript>
     453
     454A time-period is an interval, [begin end), where begin and end are time objects
     455of the same clock type. When end <= begin the interval is null.
     456
     457===== make-null-time-period
     458
     459<procedure>(make-null-time-period [CLOCK-TYPE (default-date-clock-type)])</procedure>
     460
     461Returns a null interval for the specified {{CLOCK-TYPE}}.
     462
     463===== make-time-period
     464
     465<procedure>(make-time-period BEGIN END [CLOCK-TYPE (default-date-clock-type)])</procedure>
     466
     467Returns a new time-period object. The clock types must be compatible.
     468
     469{{BEGIN}} maybe a seconds value, a date, or a time (except time-duration). A
     470seconds value or date are converted to {{CLOCK-TYPE}}.
     471
     472{{END}} maybe a seconds value, a date, or a time. A seconds value or date are
     473converted to the same clock type as {{BEGIN}}. A time-duration is treated as an
     474offset from {{BEGIN}}.
     475
     476===== copy-time-period
     477
     478<procedure>(copy-time-period TIME-PERIOD)</procedure>
     479
     480Returns a copy of {{TIME-PERIOD}}.
     481
     482===== time-period-begin
     483
     484<procedure>(time-period-begin TIME-PERIOD)</procedure>
     485
     486Returns the start time for the {{TIME-PERIOD}}.
     487
     488===== time-period-end
     489
     490<procedure>(time-period-end TIME-PERIOD)</procedure>
     491
     492Returns the end time for the {{TIME-PERIOD}}.
     493
     494===== time-period-last
     495
     496<procedure>(time-period-last TIME-PERIOD)</procedure>
     497
     498Returns the last time for the {{TIME-PERIOD}}; (time-period-end - 1ns).
     499
     500===== time-period-type
     501
     502<procedure>(time-period-type TIME-PERIOD)</procedure>
     503
     504Returns the clock-type of the {{TIME-PERIOD}}.
     505
     506===== time-period?
     507
     508<procedure>(time-period? OBJECT)</procedure>
     509
     510Is {{OBJECT}} a time-period?
     511
     512===== time-period-null?
     513
     514<procedure>(time-period-null? TIME-PERIOD)</procedure>
     515
     516Is the {{TIME-PERIOD}} null?
     517
     518===== time-period-length
     519
     520<procedure>(time-period-length TIME-PERIOD)</procedure>
     521
     522Returns the time-duration of the {{TIME-PERIOD}}.
     523
     524===== time-period-compare
     525
     526<procedure>(time-period-compare TIME-PERIOD-1 TIME-PERIOD-2) => INTEGER</procedure>
     527
     528Returns {{-1}} when {{TIME-PERIOD-1}} < {{TIME-PERIOD-2}}, {{0}} when
     529{{TIME-PERIOD-1}} = {{TIME-PERIOD-2}} and {{1}} {{TIME-PERIOD-1}} >
     530{{TIME-PERIOD-2}}.
     531
     532===== time-period=?
     533
     534<procedure>(time-period=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     535
     536Does {{TIME-PERIOD-1}} begin & end with {{TIME-PERIOD-2}}?
     537
     538===== time-period<?
     539
     540<procedure>(time-period<? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     541
     542Does {{TIME-PERIOD-1}} end before {{TIME-PERIOD-2}} begins?
     543
     544===== time-period>?
     545
     546<procedure>(time-period>? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     547
     548Does {{TIME-PERIOD-1}} begin after {{TIME-PERIOD-2}} ends?
     549
     550===== time-period<=?
     551
     552<procedure>(time-period<=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     553
     554Does {{TIME-PERIOD-1}} end on or before {{TIME-PERIOD-2}} begins?
     555
     556===== time-period>=?
     557
     558<procedure>(time-period>=? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     559
     560Does {{TIME-PERIOD-1}} begin on or after {{TIME-PERIOD-2}} ends?
     561
     562===== time-period-preceding
     563
     564<procedure>(time-period-preceding TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     565
     566Return the portion of {{TIME-PERIOD-1}} before {{TIME-PERIOD-2}} or {{#f}} when
     567it doesn't precede.
     568
     569===== time-period-succeeding
     570
     571<procedure>(time-period-succeeding TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     572
     573Return the portion of {{TIME-PERIOD-1}} after {{TIME-PERIOD-2}} or {{#f}} when
     574it doesn't succeed.
     575
     576===== time-period-contains/period?
     577
     578<procedure>(time-period-contains/period? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     579
     580Is {{TIME-PERIOD-2}} within {{TIME-PERIOD-1}}?
     581
     582===== time-period-contains/time?
     583
     584<procedure>(time-period-contains/time? TIME-PERIOD TIME)</procedure>
     585
     586Is {{TIME}} within {{TIME-PERIOD}}?
     587
     588{{TIME}} is converted to a compatible clock-type if possible.
     589
     590===== time-period-contains/date?
     591
     592<procedure>(time-period-contains/date? TIME-PERIOD DATE)</procedure>
     593
     594Is {{DATE}} within {{TIME-PERIOD}}?
     595
     596{{DATE}} is converted to a compatible time if possible.
     597
     598===== time-period-contains?
     599
     600<procedure>(time-period-contains? TIME-PERIOD OBJECT)</procedure>
     601
     602Is {{OBJECT}} within {{TIME-PERIOD}}?
     603
     604{{OBJECT}} maybe a time, date, or time-period.
     605
     606===== time-period-intersects?
     607
     608<procedure>(time-period-intersects? TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     609
     610Does {{TIME-PERIOD-2}} overlap {{TIME-PERIOD-1}}?
     611
     612===== time-period-intersection
     613
     614<procedure>(time-period-intersection TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     615
     616The overlapping time-period of {{TIME-PERIOD-2}} and {{TIME-PERIOD-1}}, or
     617{{#f}} when no overlap.
     618
     619===== time-period-union
     620
     621<procedure>(time-period-union TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     622
     623Returns the time-period spanned by {{TIME-PERIOD-1}} and {{TIME-PERIOD-2}}, or
     624{{#f}} when they do not intersect.
     625
     626===== time-period-span
     627
     628<procedure>(time-period-span TIME-PERIOD-1 TIME-PERIOD-2)</procedure>
     629
     630Returns the time-period spanned by {{TIME-PERIOD-1}} and {{TIME-PERIOD-2}},
     631including any gaps.
     632
     633===== time-period-shift
     634
     635<procedure>(time-period-shift TIME-PERIOD DURATION)</procedure>
     636
     637Returns a copy of {{TIME-PERIOD}} shifted by {{DURATION}}.
     638
     639===== time-period-shift!
     640
     641<procedure>(time-period-shift! TIME-PERIOD DURATION)</procedure>
     642
     643Returns {{TIME-PERIOD}} shifted by {{DURATION}}.
    626644
    627645
Note: See TracChangeset for help on using the changeset viewer.