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

Reply via email to