[Pulp-list] Date and Time Feedback Requested!

Jason L Connor jconnor at redhat.com
Fri Apr 15 19:15:59 UTC 2011


On Fri, 2011-04-15 at 11:15 -0700, Mike McCune wrote:
> On 04/15/2011 10:36 AM, Jason L Connor wrote:
> > Hi Everyone,
> >
> > I'm personally struggling with date and time formats and timezone data
> > in pulp.
> >
> > We're currently using 2 different formats, 1 for specifying date and
> > time information and 1 for reporting date and time information. I'd like
> > to see us unify this, and I'm looking for feedback on what is
> > easiest/most desired.
> >
> > For reporting, we're generally using a timestamp as seconds since the
> > epoch as a float in the utc timezone.
> >
> > For specifying date time data, we're accepting objects with the
> > following integer fields: (year, month, day, hour, minute) in the local
> > timezone of the pulp server.
> >
> >
> > This is obviously confusing... (especially because some of the reporting
> > is using the second format, like for repo schedules)
> >
> >
> > Here's what I'd like to propose:
> >
> > The date/time format is always an object, with the fields(year, month,
> > day, hour, minute, second)
> > Please note that pulp will not honor the 'second' field when specify
> > times, it's only use is in reporting.
> >
> > The times are always specified in the timezone local to the pulp server.
> >
> > This keeps the logic on pulp as simple as possible. As well as providing
> > both a machine parsable and human readable format for date/time data.
> >
> > Ok, fire away...
> 
> I'm not sure from your email what this really means from a Database, 
> REST-API and CLI impact.
> 
> Are you saying that dates will no longer be stored as a timestamp and 
> instead will be a custom object with YY/MM/DD mm:ss vs a timestamp and 
> the API's JSON will now have this set of fields?
> 
> {
>    "scheduled_time": null,
>    "exception": null,
>    "status_path": 
> "/pulp/api/repositories/test2/sync/a3020f94-678b-11e0-93fd-0019d1630404/",
>    "finish_time": "1302891027",
>    "start_time": "1302891025",
> ...
> }
> 
> would now become:
> 
> 
> {
>    "scheduled_time": null,
>    "exception": null,
>    "status_path": 
> "/pulp/api/repositories/test2/sync/a3020f94-678b-11e0-93fd-0019d1630404/",
>    "finish_time": {
>                     "day": "15",
>                     "month": "Apr",
>                     "year": "2011",
>                     "hour": "11",
>                     "minute": "10",
>                     "second": "27"
>                   },
>    "start_time": {
>                     "day": "15",
>                     "month": "Apr",
>                     "year": "2011",
>                     "hour": "11",
>                     "minute": "09",
>                     "second": "14"
>                   },
> ...
> }
> 
> or something similar?
> 
> My first reaction is I prefer timestamps since it is a standard format 
> that all languages can parse and understand.  The complex object option 
> requires custom code to be written for all callers of the API which is 
> onerous, but I'll let you clarify before I go further...
> 
> Mike

Yep, that's the gist of it.

I'm liking the objects because it's easier to specify date times in, as
well as have some control over the granularity that pulp honors.

Objections, however, are welcome. I'm trying to get a feel for what to
use here.

As far as timezone data, we can add the timezone as a string in the
object.
{ 'year': 2011,
  'month': 4,
  'day': 15,
  'hour': 13,
  'minute': 14,
  'second': 49,
  'timezone': 'America/Denver'
}
-- 
Jason L Connor
linear on freenode #pulp
http://pulpproject.org/
RHCE: 805010912355231
GPG Fingerprint: 2048R/CC4ED7C1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20110415/1c52219a/attachment.sig>


More information about the Pulp-list mailing list