integer - Incorrect epoch date in node.js using thrift -
i seem getting different epoch date value in node.js thrift object stored in mongo database , returned service
thrift definition file (thrift v0.9.0), have
struct profile { ... 4: i64 createdate, 5: i64 lastupdatedate
mongo record
"createdtimestamp" : numberlong("1366334385361"), "lastupdatedtimestamp" : numberlong("1366334385361")
node reports
createdate: 534785233, lastupdatedate: 534785233
the generated node thrift client seems have i64 referenced.
if (this.createdate !== null && this.createdate !== undefined) { output.writefieldbegin('createdate', thrift.type.i64, 14); output.writei64(this.createdate); output.writefieldend(); }
i appreciate insight comes along.
thanks
binary representation given numbers :
1366334385361 -> 10011111000011111111000000010110011010001 534785233 -> 00000000000011111111000000010110011010001
i.e. if take lower 32 bits of 1366334385361, 534785233. somewhere in program or package using, getting converted/truncated 32 bit integer e.g. int(1366334385361)
Comments
Post a Comment