Java example to convert FlashAir decimal 16-bit integer to date/time format? -


in retrieving file list flashair 2nd gen using command cgi explained here: flashair list cgi command decimal 16-bit integers represent date , time of file.

the specification (in link posted) explains how understand retrieved values, lacks java example. tried downloading , inspecting android sample code posted in flashair developer's website flashair tutorial android - downloading content, use file names, not perform conversions.

just extract bits specified.

assuming have short time , short date:

int seconds = (time & 31) * 2; int minutes = (time >> 5) & 63; int hours   = (time >> 11) & 31; int day   = date & 31; int month = (date >> 5) & 15; int year  = ((data >> 9) & 127) + 1980; 

then make datetime out of that.

it's not clear whether raw years can negative. wrote such can't be, if they're supposed able negative (to represent dates before 1980) remove & 127.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -