Help! Python to compare dates in diff. timezones
Sunit Joshi
sjoshi at ingr.com
Mon Jul 29 09:05:21 EDT 2002
Gerhard Häring <gerhard.haering at gmx.de> wrote in message news:<mailman.1027886128.472.python-list at python.org>...
> * Sunit Joshi <sjoshi at ingr.com> [2002-07-28 09:17 -0700]:
> > Hello All
> >
> > I have problem which is like this:
> > I have two sites A & B which are in diff. countries in diff.
> > timezones.
> > Now both sites have same drawings (Microstation files with same names)
> > whose revision dates (as integer since epoch) are stored in a table in
> > database at both sites. The database structure is same on both sites
> > with identical table names.
>
> Is there some sort of replication taking place?
>
> > Now since the sites are different timezones, I was wondering what
> > would be the best way to compare drawings, using Python, that have
> > changed between two sites; for e.g. if site A wants to gets a list of
> > all models that have changed at site A.
>
> Just normalize the dates to use GMT, so that you can compare them.
>
> > I'm open to any suggestion like using a query over HTTP, using XML,
> > etc.
>
> It sounds easiest to just make both db servers accessible at sites A and
> B and let that do somebody who knows their stuff about security (I'm not
> saying you don't). Another transport layer like HTTP doesn't add any
> value for database access, IMO.
>
> Gerhard
Like I mentioned, the time is stored in the table as long secs, so
converting to GMT is basically, time.gmtime([secs]). I guess I can do
this for both the sites and just compare(A, B). A +ve would then mean
A's changed, -ve B's changed otherwise both are the same.
Does this sound right....
thanks
Sunit
More information about the Python-list
mailing list