[Koha-devel] 1 timezone system?

Mark Tompsett mtompset at hotmail.com
Thu May 5 05:15:32 CEST 2016


Greetings,

Sorry if I took something out of context to create a different thread.

David Cook wrote:
> “Maybe Koha is fine just being a 1 timezone system.”

What I would prefer is a 1 timezone backend, with user specific timezone front-end with a default timezone.
Why? Global consortia. The organization I work with has libraries across... 1,2,3, perhaps 4 time zones maybe 5.
I could easily imagine it increasing in the future.

GPML,
Mark Tompsett

P.S. Back to your regularly scheduled Y2038 doomsday discussion.

From: David Cook<mailto:dcook at prosentient.com.au>
Sent: Wednesday, May 04, 2016 8:23 PM
To: 'Barton Chittenden'<mailto:barton at bywatersolutions.com>
Cc: koha-devel at lists.koha-community.org<mailto:koha-devel at lists.koha-community.org>
Subject: Re: [Koha-devel] Invalid local time for date in time zone:America/Santiago

Hey Barton,

Yes, the year 2038 for timestamps is a problem even on 64 bit machines.

Here’s a test you can do on a 64 bit MySQL install on a 64 bit OS:

select unix_timestamp('2038-01-20');
select from_unixtime(2548990800);

Both will return null.

You can also try storing a value of ‘2039-01-01’ into a timestamp column, and you’ll get the following message :

Out of range value for column 'timestamp' at row 1

Here’s some good explanations:
http://askubuntu.com/questions/675116/timestamp-year-2038-problem-for-64-bit-ubuntu-system
https://bugs.mysql.com/bug.php?id=12654

Also, I’d never heard of date_t before your email, and the only references I can see to it are for specific projects which have implemented it as a new data structure themselves. I think time_t is the standard and that depends on your system architecture, although as you can see in those above links – it’s more complicated than that in MySQL.

--

issues.date_due is already a DATETIME data type, so we don’t need to worry about 2038. As for time zones, why would it be tricky storing it in UTC?

At the moment, you can only have due dates in one time zone. That means you can’t have library systems spanning more than one timezone. Maybe that’s a rare or uncommon scenario, but here in the state of New South Wales, we actually do have 2 different timezones. In that case, when you’re doing a check out, you choose a local time, convert it to UTC for storage, and then render it in local time for the library user and library staff.

I imagine the trickiest part would be the Reports module, as users wouldn’t know to use something like the CONVERT_TZ() function.

Calculating overdues against holidays might be tricky… although that’s a case of just getting your timezone right as well. I reckon your timezone should be set per library, so you just fetch your UTC datetime, convert it to your local library timezone, probably convert it to floating to do math, and then convert it back to local timezone, and then whatever else you need. It sounds complex, but it’s really not that bad when you have it structured well.

--

Barton, I’m not sure I understand your reaction :p. I also field support tickets for a living, and I think it would be a lot easier to field tickets for a re-architected system that is created off years of experience rather than years of technical debt. Of course, I know re-architecting a system is also a lot easier said than done. But I think that’s why you see folks like EBSCO thinking about creating a microservice based system which can integrate with Koha. Incremental change.

I suppose dates are most important when it comes to circulation and patrons… and I think that’s what people probably think about when they think of core Koha. I suppose acquisitions  and serials require a lot of careful date handling as well… I was actually thinking about Koha and “asset tracking” in general this morning on the way to the office.

I don’t know. Maybe Koha is fine just being a 1 timezone system. I imagine library systems spanning over multiple timezones are probably the exception rather than the rule.

We need to re-think some of our DateTime logic though. Whether we use ‘floating’ timezones more consistently, or are careful with creating local times that don’t exist…


David Cook
Systems Librarian

Prosentient Systems
72/330 Wattle St
Ultimo, NSW 2007

Office: 02 9212 0899
Direct: 02 8005 0595

From: Barton Chittenden [mailto:barton at bywatersolutions.com]
Sent: Thursday, 5 May 2016 12:04 AM
To: David Cook <dcook at prosentient.com.au>
Subject: Re: [Koha-devel] Invalid local time for date in time zone: America/Santiago



On Thu, Apr 28, 2016 at 7:27 PM, David Cook <dcook at prosentient.com.au<mailto:dcook at prosentient.com.au>> wrote:
I don’t think using “timestamp” would be preferable to “datetime”.

First, MySQL’s timestamp seems to suffer from the Year 2038 problem (https://en.wikipedia.org/wiki/Year_2038_problem)(http://bugs.mysql.com/bug.php?id=12654), while datetime does not.


Even on 64 bit machines?

Oh MySQL, MySQL, knowest thou not of date_t?

Second, you’d be handling timezones at the data level rather than at the application level. I’d rather have a convention of storing DATETIME as UTC, having Koha fetch that DATETIME as UTC, and then doing timezone conversions from there.


I think that could be handled *relatively* transparently in DateUtils.pm, but there are a lot of corner cases like due dates that get ... tricky.

As for the same server running different time zones, you can change the timezone on a per connection setting I think, but that could be a hassle. I think it would be easier just to store things clearly as UTC. This is done on a different project I work on, and it works well.

Oh, I think it’ll be a nightmare changing timezone/timestamp/datetime handling in Koha. I don’t even know if it’s possible, to be honest. Well, it would be possible, but it would likely be an error-prone process.

It’s things like this which make me think that we need to start thinking about a version of Koha that doesn’t have a clear upgrade path. A Koha with some major architectural changes which will need a skilled hand to migrate to. It won’t be nice for a lot of people… but I don’t know how else we’re going to make some major changes without dramas.

From a design standpoint, I agree.

From the point of view of someone who fields support tickets for a living:

NOOOOOOOOOOOOOOOOOOOOO!!!!

... but that's just an emotional response.

Cheers,

--Barton


________________________________
_______________________________________________
Koha-devel mailing list
Koha-devel at lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20160505/b46f878e/attachment-0001.html>


More information about the Koha-devel mailing list