It would be nice if just adding '%_' to the time format would work, but unfortunately it isn't quite that simple:
- %_ doesn't supply a leading period (.), so you instead need to add '.%_' to get the proper separator
- %_ doesn't work correctly (in this context) for a time with zero milliseconds - it will print a single 0 in this case
So I think something like this will work better:
| tfmt |
tfmt := (self asMilliseconds rem: 1000) ~= 0
ifTrue: [ tfmt := 'T%H:%M:%S.%_' ] "$NON-NLS$"
ifFalse: [ tfmt := 'T%H:%M:%S' ]. "$NON-NLS$"
Locale current lcTime copy
dFmt: '%Y-%m-%d'; "$NON-NLS$"
tFmt: tfmt;
printDate: self date on: aStream;
printTime: self time on: aStream.