There is a datetime addon with simplified math routines, but generally you want 
to store seconds from a fixed date.  One way to get fairly precise millisecond 
differences over a long range compared to now (or reference date passed as x).


(6!:0@(''"_)$: ]) : (-&({: - <.@{:) + -&(2100 13 32 24 60 60x &#.)&:<.) (2016 4 
16 9 49 19.281)
1049.03

and if you only care about minutes, you would apply a suitable rounding 
function that reflects how you care about minutes.



----- Original Message -----
From: Martin Kreuzer <[email protected]>
To: [email protected]
Sent: Saturday, April 16, 2016 6:49 AM
Subject: [Jprogramming] Foreigns

One of my teachers once told me "It's even sillier to not ask a silly 
question" ... so here I go:

Extracting SystemDateTime I do get a vector like this
    ] sdt=. 6!:0 ''
2016 4 16 9 12 59.257
which -from now on- has that value
    sdt
2016 4 16 9 12 59.257

To get the current minute I might do something like
    ] mins=. {: 5 {. sdt
12
which gives the same result some time after, unless I explicitely do
    ] mins=. {: 5 {. sdt=. 6!:0 ''
30

Q:
Is there a way to sort of "wrap" the foreign (6!:0 '') so that "sdt" 
will show the _current_ date/time string when called..?
(Sorry if I missed to make myself clear.)

Same question arose when e.g. trying stuff like
-- check print precision
    ppchk=. 9!:10 ''
-- set print precision
    ppset=. 3 : '9!:11 (y)'  NB. seems to work ...
    ppset 7

    9!:10 ''
7
    ppchk
7
    ppset 11

    9!:10 ''
11
    ppchk  NB. has (of course) still the previous value ...
7

And (again) here comes the silly
Q:
Is there a way to define "sdt" or "ppchk" (from above) so that they 
immediately react to changes to the environment..?
(Looks to me if I'm asking for a verb without a noun to act on; is 
that the moment the empty string ('') comes into play and the dog 
chases its tail..?)

-M

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to