[squeak-dev] The Inbox: Chronology-Core-cmm.53.mcz

David T. Lewis lewis at mail.msen.com
Fri May 1 14:48:07 UTC 2020


On Wed, Apr 29, 2020 at 11:51:55PM +0000, commits at source.squeak.org wrote:
> Chris Muller uploaded a new version of Chronology-Core to project The Inbox:
> http://source.squeak.org/inbox/Chronology-Core-cmm.53.mcz
> 
> ==================== Summary ====================
> 
> Name: Chronology-Core-cmm.53
> Author: cmm
> Time: 29 April 2020, 6:51:53.53317 pm
> UUID: b930b208-c85e-4c6b-8254-2837493384bd
> Ancestors: Chronology-Core-nice.52
> 
> - Extend the API to allow an integral representation of DateAndTime's, by introducing
> 
> 	DateAndTime class>>#fromMicroseconds:
> 	DateAndTime>>#asMicroseconds
> 
> which go along with the existing API:
> 
> 	DateAndTime class>>#fromSeconds:
> 	DateAndTime>>#asSeconds

-1

There is no need to add to the API. You already have Smalltalk seconds
at any level of precision care to use.

  now := DateAndTime now. "==> 2020-05-01T09:54:37.73365-04:00"
  seconds := now asExactSeconds.
  seconds asScaledDecimal. "==> 3765794077.73365s5"
  copyOfNow := DateAndTime fromSeconds: seconds.
  copyOfNow utcMicroseconds. "1588341277733650"
  now utcMicroseconds. "==> 1588341277733650"
  copyOfNow = now. "==> true"

> 
> - Every Squeak with the substring "utcMicrosecond" in the selector name refers to the number of microseconds since the POSIX epoch (1/1/1971 at 00:00:00.000), __except for one__:  Time utcMicroseconds.  Therefore, to avoid astonishment when using it with the "utc" API of DateAndTime, rename it without the "utc" prefix.
> 

+1

However, it is probably not a good idea to modify the existing method.
It may be safer to "deprecate" it by hiding it in a private category,
and updating the method comment to encourage people to use the new
name in the future.

Dave


More information about the Squeak-dev mailing list