You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Ted Yu <te...@yahoo.com> on 2009/10/28 19:25:37 UTC
datetime type in thrift
>From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
Is there plan for thrift to add datetime type support ?
I see alternative such as:
http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
Regards
RE: datetime type in thrift
Posted by Mark Slee <ms...@facebook.com>.
Just to quickly chime in, I basically agree with what's already been said here. Philosophically, we wanted to constrain the set of built-in Thrift types to only those that are very common across all programming languages. This, for instance, is why we even decided against supporting unsigned integers.
Though similar datetime implementations do exist in many languages, there is no real standard for how to represent a datetime in all programming languages, or over the network. Thrift would be sort of inventing a type here. Most languages that do support a datetime type of some sort offer very simple APIs to construct datetime objects from milli/micro-second counters.
In my opinion, if you're not bundling timezone info in them, datetime objects offer little benefit over using milli/micro-seconds since the epoch. And supporting timezones in any form is something I'd definitely rather not ever see pushed down into the Thrift layer.
Cheers,
Mark
-----Original Message-----
From: Matthieu Imbert [mailto:matthieu.imbert@ens-lyon.fr]
Sent: Wednesday, October 28, 2009 12:49 PM
To: thrift-user@incubator.apache.org
Subject: Re: datetime type in thrift
Ted Yu wrote:
>>>From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
>
> Is there plan for thrift to add datetime type support ?
>
> I see alternative such as:
> http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
>
> Regards
i use this:
struct Timestamp {
1: i32 s = -2147483648,
2: i32 micro_s = 0,
}
--
Matthieu
Re: datetime type in thrift
Posted by Matthieu Imbert <ma...@ens-lyon.fr>.
Ted Yu wrote:
>>>From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
>
> Is there plan for thrift to add datetime type support ?
>
> I see alternative such as:
> http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
>
> Regards
i use this:
struct Timestamp {
1: i32 s = -2147483648,
2: i32 micro_s = 0,
}
--
Matthieu
Re: datetime type in thrift
Posted by Bryan Duxbury <br...@rapleaf.com>.
Here, we use either milliseconds since epoch or seconds since epoch,
depending on what amount of granularity we need.
-Bryan
On Oct 28, 2009, at 11:25 AM, Ted Yu wrote:
> From my experience working with web services using SOAP in PHP and
> Java, datetime handling is a source of big headache.
>
> Is there plan for thrift to add datetime type support ?
>
> I see alternative such as:
> http://www.evernote.com/about/developer/api/ref/
> Types.html#Typedef_Timestamp
>
> Regards
>
>
>
Re: datetime type in thrift
Posted by Dave Engberg <de...@evernote.com>.
Our definition of 'timestamp' is a bit clunky, yes. We're using
millisecond resolution because this happened to map well into our
service implementation (in Java).
Ignoring the milliseconds is even more embarrassing -- we're storing the
times in MySQL, which can't handle sub-millisecond resolution in its
date/time fields. (We found this out too late to resolve easily, etc.)
Michael Greene wrote:
> We are using microseconds-since-epoch here. One downside to this
> approach from an interop perspective is the ease at which Java,
> Javascript, and UNIX in general deal with milliseconds-since-epoch vs.
> microseconds. If I didn't need microseconds for business reasons, I
> would use milliseconds. When I asked around on #thrift awhile back,
> that was the most common approach.
>
> Michael
>
> On Wed, Oct 28, 2009 at 1:29 PM, David Reiss <dr...@facebook.com> wrote:
>
>> I would suggest doing something similar to what Evernote is doing.
>> (Though if you're using an i64, you might as well use microseconds.)
>>
>> --David
>>
>> Ted Yu wrote:
>>
>>> From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
>>>
>>> Is there plan for thrift to add datetime type support ?
>>>
>>> I see alternative such as:
>>> http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
>>>
>>> Regards
>>>
>>>
>>>
>>>
Re: datetime type in thrift
Posted by Michael Greene <mi...@gmail.com>.
We are using microseconds-since-epoch here. One downside to this
approach from an interop perspective is the ease at which Java,
Javascript, and UNIX in general deal with milliseconds-since-epoch vs.
microseconds. If I didn't need microseconds for business reasons, I
would use milliseconds. When I asked around on #thrift awhile back,
that was the most common approach.
Michael
On Wed, Oct 28, 2009 at 1:29 PM, David Reiss <dr...@facebook.com> wrote:
> I would suggest doing something similar to what Evernote is doing.
> (Though if you're using an i64, you might as well use microseconds.)
>
> --David
>
> Ted Yu wrote:
>> From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
>>
>> Is there plan for thrift to add datetime type support ?
>>
>> I see alternative such as:
>> http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
>>
>> Regards
>>
>>
>>
>
Re: datetime type in thrift
Posted by Ted Yu <te...@yahoo.com>.
I noticed there isn't type called object in thrift.
thrift can actually pass i64 as timestamp across the wire and define methods that convert i64 to native datetime type in each language.
Meaning thrift can handle serialization/deserialization of timestamp type transparently.
--- On Wed, 10/28/09, David Reiss <dr...@facebook.com> wrote:
> From: David Reiss <dr...@facebook.com>
> Subject: Re: datetime type in thrift
> To: "thrift-user@incubator.apache.org" <th...@incubator.apache.org>
> Date: Wednesday, October 28, 2009, 11:29 AM
> I would suggest doing something
> similar to what Evernote is doing.
> (Though if you're using an i64, you might as well use
> microseconds.)
>
> --David
>
> Ted Yu wrote:
> > From my experience working with web services using
> SOAP in PHP and Java, datetime handling is a source of big
> headache.
> >
> > Is there plan for thrift to add datetime type support
> ?
> >
> > I see alternative such as:
> > http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
> >
> > Regards
> >
> >
> >
>
Re: datetime type in thrift
Posted by David Reiss <dr...@facebook.com>.
I would suggest doing something similar to what Evernote is doing.
(Though if you're using an i64, you might as well use microseconds.)
--David
Ted Yu wrote:
> From my experience working with web services using SOAP in PHP and Java, datetime handling is a source of big headache.
>
> Is there plan for thrift to add datetime type support ?
>
> I see alternative such as:
> http://www.evernote.com/about/developer/api/ref/Types.html#Typedef_Timestamp
>
> Regards
>
>
>