eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'AbstractTime::PrintBindingMirror':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: PrintBindingMirror (private in AbstractTime

This class is only visible from within AbstractTime.

Inheritance:

   Object
   |
   +--Collection
      |
      +--KeyedCollection
         |
         +--AbstractTime::PrintBindingMirror

Package:
stx:libbasic
Category:
Kernel-Chronology
Owner:
AbstractTime
Author:
cg

Description:


private print support: simulate a Dictionary with bindings for printing
a timeobject.
languageOrNil can be #en, #fr, #de or nil for the current language.

bindings:
   %h      hours, 00..23 (i.e. european)  0-padded to length 2
   %m      minutes, 00..59                0-padded to length 2
   %s      seconds, 00..59                0-padded to length 2
   %i      milliseconds, 000..999         0-padded to length 3
   %j      microseconds, 000000..999999   0-padded to length 6

Timestamp only:
   %(day)   day, 00..31                    0-padded to length 2
   %(month) month, 00..12                  0-padded to length 2
   %(year)  year, 4 digits                 0-padded to length 4

special:
   %H      24-hours - unpadded
   %M      minutes - unpadded
   %S      seconds - unpadded
   %I      milliseconds, unpadded
   %J      microseconds, unpadded
   %F      subsecond fraction, unpadded with as many post-digits as appropriate
           (i.e. for .1 , .01 , .001 etc.)

   %t      seconds within hour  (unpadded)
   %T      seconds from midNight  (unpadded)

   %(milli) milliseconds unpadded - alias for %I for convenience
   %(milli1) milliseconds, truncated to 1/10th of a second 0..9
   %(milli2) milliseconds, truncated to 1/100th of a second 00..99 0-padded to length 2
   %(milli3) milliseconds, padded to 3 (same as %i for convenience)
   %(milliF1) milliseconds + 1 digits of micros
   %(milliF2) milliseconds + 2 digits of micros
   %(milliF3) milliseconds + 3 digits of micros
   %(milliF4) milliseconds + 4 digits of micros

   %(micro) microseconds unpadded - alias for %J for convenience
   %(micro6) microseconds, padded to 6 (same as %j for convenience)

   %(nano) nanoseconds unpadded
   %(nano9) nanoseconds, padded to 9

   %(pico) picoseconds unpadded
   %(pico12) picoseconds, padded to 12

   %(fract) fraction part - as many as needed alias for %F for convenience

Timestamp only:
   %(Day)         - day - unpadded
   %(Month)       - month - unpadded
   %(yearOrTime)  - year or time 5 digits    as in unix-ls:
                                             year if it is not the current year;
                                             time otherwise
   %(weekDay)      - day in week (1->monday, 2->tuesday, ... ,7->sunday)

   %(dayName)      - full day name
   %(DayName)      - full day name, first character uppercase
   %(DAYNAME)      - full day name, all uppercase

   %(monthName)    - full month name
   %(MonthName)    - full month name, first character uppercase
   %(MONTHNAME)    - full month name, all uppercase

   %(shortDayName) - short (abbreviated) day name
   %(ShortDayName) - short (abbreviated) day name, first character uppercase
   %(SHORTDAYNAME) - short (abbreviated) day name, all uppercase

   %(shortMonthName) - short (abbreviated) month name
   %(ShortMonthName) - short (abbreviated) month name, first character uppercase
   %(SHORTMONTHNAME) - short (abbreviated) month name, all uppercase

   %(nth)          - counting day-in-month (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')
   %(weekDayNth)   - counting day-in-week (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')
   %(weekNth)      - counting week-in-year (1->'st'; 2->'nd'; 3->'rd'; 4...->'th')

The ISO8601 printString are generated with:

  Year:
     YYYY (eg 1997)
           Date today printStringFormat:'%(year)'
           Timestamp now printStringFormat:'%(year)'

  Year and month:
     YYYY-MM (eg 1997-07)
           Date today printStringFormat:'%(year)-%(month)'
           Timestamp now printStringFormat:'%(year)-%(month)'

  Complete date:
     YYYY-MM-DD (eg 1997-07-16)
           Date today printStringFormat:'%(year)-%(month)-%(day)'
           Timestamp now printStringFormat:'%(year)-%(month)-%(day)'

  Complete date plus hours and minutes:
     YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
           Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m%(TZD)'

  Complete date plus hours, minutes and seconds:
     YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
           Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s%(TZD)'

  Complete date plus hours, minutes, seconds and a decimal fraction of a second
     YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
           Timestamp now printStringFormat:'%(year)-%(month)-%(day)T%h:%m:%s.%(milli2)%(TZD)'

    responsibilities:    
   generate print strings as specified by a format character

    collaborators:    
   private for Time objects

    API:
   strictly private
   

    [instance variables:]

    [class variables:]


Related information:



Class protocol:

instance creation
o  target: timeArg language: languageArg


Instance protocol:

accessing
o  target: timeArg language: languageArg

bindings
o  basicPrintBindingAt: key
basic common for time, timeDuration and timeStamp

o  datePrintBindingAt: key
Date:

o  timeDurationPrintBindingAt: key
Additional formats available here (for timeDuration) are:
%(Hd) hours in day (i.e. 0..23)
%(hd) hours in day padded to 2 chars (i.e. 00..23)

%(Gyr) giga years (i.e. for 5100000000 years, we get 5.1 asFixedPoint:1 )
%(Myr) mega years (i.e. for 5100000 years, we get 5.1 asFixedPoint:1 )
%(Kyr) kilo years (i.e. for 5100 years, we get 5.1 asFixedPoint:1 )
%(yrR) years rounded (i.e. for 730 days, we get 2 asFixedPoint:1 )
%(monR) month rounded (i.e. for 45 days, we get 1.5 asFixedPoint:1 )
%(d) days
%(w) weeks truncated
%(y) years truncated
%(wR) weeks rounded (i.e. for 45 days, we get 6.xxx asFixedPoint:1 )
%(dR) days rounded (i.e. for 36 hours, we get 1.5 asFixedPoint:1 )
%(dw) days in week (rest days after taking out the weeks)
%(dy) days in year (rest days after taking out the years)
%(hR) hours rounded (i.e. for 3h 30m, we get 3.5 asFixedPoint:1 )
%(mR) minutes rounded (i.e. for 2m 30s, we get 2.5 asFixedPoint:1 )
%(sR) seconds rounded to 1 postDecimal (i.e. for 2s 100ms, we get 2.1 asFixedPoint:1 )
%(hT) hours truncated (i.e. for 1d 2h 45m, we get 26)
%(mT) minutes truncated (i.e. for 2h 25m 50s, we get 145)
%(sT) seconds truncated (i.e. for 1m 15s 35ms, we get 75)

o  timePrintBindingAt: key
Time:

o  timeStampPrintBindingAt: key
Timestamp:

o  yearInCentury: century
self error:'year cannot be represented (not in century)'

o  yearInCenturySplittedAt: lowBound
to split between 19xx and 20xx
at lowBound

dictionary protocol
o  at: key
(comment from inherited method)
return the value stored under akey.
Raise an error if not found

o  at: key ifAbsent: exceptionValue
time must come first (for m -> minutes)

o  keys
(comment from inherited method)
return a collection containing the keys of the receiver

o  keysAndValuesDo: aBlock
(comment from inherited method)
evaluate aBlock for each key and value

o  keysDo: aBlock
(comment from inherited method)
evaluate the argument, aBlock for every key in the collection.

o  size
(comment from inherited method)
return the number of elements in the receiver.
This is usually redefined in subclasses for more performance.

private
o  allKeys
needed for collection protocol (and in inspector)

o  date

o  time



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 19 May 2024 23:16:17 GMT