Don - that works great. Thank you

_8 (] (256 #. ]) (a. i. ]))\ bin

or

times=: _8 (256 #.  a. i. ])\ bin






On Tue, Oct 7, 2014 at 10:32 AM, Don Guinn <[email protected]> wrote:

> I took your numbers and did
>
>    256#.0 0 1 72 224 139 75 119
> 1412516498295
>
> on my laptop and phone and got the same answer. But it was an integer on my
> laptop and floating on my phone. Might have to flip things around if you
> have enian problems.
>
> On Tue, Oct 7, 2014 at 8:23 AM, Joe Bogner <[email protected]> wrote:
>
> > Thanks Don. It looks like a long on java is 64 bits, 8 bytes, even on a
> 32
> > bit architecture.
> >
> > I'm uncertain of the right path forward. I could change the java app to
> log
> > a 4 byte timestamp, or I can figure out a way to convert the 8 byte to an
> > integer on J32.
> >
> > The simplest change would be to have some mechanism to convert it on J32,
> > but it would need to be fairly performant as the file may easily have 1M+
> > values.
> >
> >
> >
> > On Tue, Oct 7, 2014 at 9:34 AM, Don Guinn <[email protected]> wrote:
> >
> > > I checked IF64 on my phone and its value was zero. Help says that
> > _3(3!:4)
> > > only is valid for J64
> > >
> > > On Tue, Oct 7, 2014 at 6:00 AM, Joe Bogner <[email protected]>
> wrote:
> > >
> > > > I have a android app that is logging sensor data to a text file using
> > > > java's DataInputStream.writeLong[1]. It is logging a timestamp each
> > > > time it gets a step (pedometer). The timestamp comes from getTime()
> > > > [2]
> > > >
> > > > I can read the file on Windows
> > > >
> > > > bin=:fread 'c:/joe/j/steps.txt'
> > > > times=: |. _3 (3!:4) |. bin
> > > >
> > > > 0 { times
> > > > 1412516498295
> > > >
> > > > tsFrom1970 =: (1970 1 1 0 0 0) tsPlus 1000 %~ ]
> > > > tsFrom1970 1 { times
> > > > 2014 10 5 13 41 38.644
> > > >
> > > >
> > > > Here is the first number:
> > > >
> > > > a. i. (8{. bin)
> > > > 0 0 1 72 224 139 75 119
> > > >
> > > > _3 (3!:4) |. (0 0 1 72 224 139 75 119 { a.)
> > > > 1412516498295
> > > >
> > > > I'd like to create a JHS app on android to show some metrics. I'm
> > > > unable to convert the binary data to a jint on android:
> > > >
> > > >    _3 (3!:4) bin
> > > > |domain error
> > > > |   _3    (3!:4)bin
> > > >    _3 (3!:4) |. bin
> > > > |domain error
> > > > |   _3    (3!:4)|.bin
> > > >
> > > >
> > > > The results are the same on Windows. I reverse it on Windows because
> > > > of big/little endian (I think)
> > > >
> > > > I could try to manually implement the encoding that's used by
> > > > writeLong but figured I'd ask here first to see if I'm missing
> > > > something simple
> > > >
> > > > [1] -
> > > >
> > >
> >
> http://docs.oracle.com/javase/7/docs/api/java/io/DataOutput.html#writeLong(long)
> > > >
> > > > [2] -
> > > >
> http://docs.oracle.com/javase/7/docs/api/java/util/Date.html#getTime()
> > > >
> ----------------------------------------------------------------------
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> 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