Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ISO8601 time printer to "traits time". #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions objects/core/time.self
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'Sun-$Revision: 30.10 $'
'30.11.0'
'
Copyright 1992-2012 AUTHORS.
See the LICENSE file for license information.
Copyright 1992-2016 AUTHORS.
See the legal/LICENSE file for license information and legal/AUTHORS for authors.
'
["preFileIn" self] value


'-- Module body'
Expand Down Expand Up @@ -47,9 +48,9 @@ SlotsToOmit: directory fileInTimeString myComment postFileIn revision subpartNam
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'time' -> () From: ( | {
'ModuleInfo: Module: time InitialContents: FollowSlot\x7fVisibility: public'
'ModuleInfo: Module: time InitialContents: InitializeToExpression: (\'30.11.0\')\x7fVisibility: public'

revision <- 'Sun-$Revision: 30.10 $'.
revision <- '30.11.0'.
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'modules' -> 'time' -> () From: ( | {
Expand All @@ -70,7 +71,7 @@ SlotsToOmit: directory fileInTimeString myComment postFileIn revision subpartNam
bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'time' -> () From: ( | {
'Comment: Non-nil when valid.\x7fModuleInfo: Module: time InitialContents: InitializeToExpression: (nil)\x7fVisibility: private'

dateTime0.
dateTime0 <- bootstrap stub -> 'globals' -> 'nil' -> ().
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'time' -> () From: ( | {
Expand Down Expand Up @@ -663,6 +664,35 @@ SlotsToOmit: directory fileInTimeString myComment postFileIn revision subpartNam
str <- ''.
} | )

bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'time' -> () From: ( | {
'Category: printing\x7fCategory: local time\x7fModuleInfo: Module: time InitialContents: FollowSlot\x7fVisibility: public'

printISO8601String = ( |
|
(year printStringPadWith0ToSize: 4), '-',
(month printStringPadWith0ToSize: 2), '-',
(date printStringPadWith0ToSize: 2),
'T',
(hour printStringPadWith0ToSize: 2), ':',
(minute printStringPadWith0ToSize: 2), ':',
(second printStringPadWith0ToSize: 2)).
} | )

bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'time' -> () From: ( | {
'Category: printing\x7fCategory: GMT\x7fModuleInfo: Module: time InitialContents: FollowSlot\x7fVisibility: public'

printISO8601StringGMT = ( |
|
(yearGMT printStringPadWith0ToSize: 4), '-',
(monthGMT printStringPadWith0ToSize: 2), '-',
(dateGMT printStringPadWith0ToSize: 2),
'T',
(hourGMT printStringPadWith0ToSize: 2), ':',
(minuteGMT printStringPadWith0ToSize: 2), ':',
(secondGMT printStringPadWith0ToSize: 2),
'Z').
} | )

bootstrap addSlotsTo: bootstrap stub -> 'traits' -> 'time' -> () From: ( | {
'Category: printing\x7fCategory: local time\x7fModuleInfo: Module: time InitialContents: FollowSlot\x7fVisibility: public'

Expand Down