bugGforth - Bugs: bug #61212, feature request: split out...

 
 

bug #61212: feature request: split out time&date to read and convert the time

Submitter:  paul r <phr>
Submitted:  Thu 23 Sep 2021 09:13:15 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  paysan
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 16 Dec 2021 06:54:52 PM UTC, comment #3: 

I changed the primitive responsible for that to >time&date&tz, which converts a second since the epoch to time&date and returns the time zone for it.

This is still a bit preliminary, because it results in a year 2038 but on a 32 bit system, and maybe we want a double as input (then use ud/mod to convert from ntime to seconds).

I close the feature request for now, and think about the input format.

Bernd Paysan <paysan>
Group administrator
Thu 23 Sep 2021 11:38:33 PM UTC, comment #2: 

Sounds ok, though the documentation should describe the um/mod conversion.  Right now the docs also don't mention ntime.

paul r <phr>
Thu 23 Sep 2021 11:35:13 PM UTC, comment #1: 


original submission:

> Currently there is a time&date word that reads the current time from the system, and splits it out into s m h D M Y.  I request splitting out the conversion part to convert an arbitrary timestamp as returned from utime:
>
> : convert-to-time&date ( utime -- s m h D M Y ) ... ;
> : date&time ( -- s m h D M Y ) utime convert-to-time&date ;
>
> The existing date&time still operates the same way to preserve compatibility, but the conversion part is made visible for users.


Looks like a good idea to make that binding to localtime more useful, yes.  I think it's ok to take seconds (localtime is only in second resolution), since you could have used utime or ntime (µs or ns as resolution) in the first place, and a simple um/mod helps you to convert that into µs and seconds or ns and seconds.

Bernd Paysan <paysan>
Group administrator
Thu 23 Sep 2021 09:13:15 PM UTC, original submission:  

Currently there is a time&date word that reads the current time from the system, and splits it out into s m h D M Y.  I request splitting out the conversion part to convert an arbitrary timestamp as returned from utime:

: convert-to-time&date ( utime -- s m h D M Y ) ... ;
: date&time ( -- s m h D M Y ) utime convert-to-time&date ;

The existing date&time still operates the same way to preserve compatibility, but the conversion part is made visible for users.

Thanks -- Paul

paul r <phr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #51956:  clock.fs added by phr (2KiB - application/octet-stream - slightly refactored version of above)
file #51955:  clock.fs added by phr (2KiB - application/octet-stream - sample application, that would be simplified with this patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by paysan (Posted a comment)
  • -email is unavailable- added by phr (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-16 paysan StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2021-09-24 phr Attached File- Added clock.fs, #51956
    2021-09-23 phr Attached File- Added clock.fs, #51955
    2021-09-23 paysan StatusNone In Progress
        Assigned toNone paysan

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code