Alex Rivera | Logout

PHP long integers for thrift

Asked 2012-07-11T14:10:15.353
9

My Thrift service expects to receive a Long integer representing a timestamp in milliseconds, but coming from PHP, I know PHP thrift is supposed to automagically turn my PHP types into thrift types, but which PHP type does it expect for Long integers? I think my computer is 64-bit, but since I think that PHP integers' length is platform dependent, I don't really want to depend upon a platform-dependent length for my integers.

I am currently grabbing microtime() and multiplying by 1000, then converting to integer. Is this the "correct" way to work with PHP & thrift long ints?

Edit
Report

1 Answer

1

Maybe you should use id of string type as like twitter: https://dev.twitter.com/docs/twitter-ids-json-and-snowflake

answered 2012-07-14T14:17:11.207

Your Answer