Implementing a non-local time of week

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Implementing a non-local time of week

Mike Craig
Hello,

I need a ReadablePartial class that holds the fields dayOfWeek, hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond. Additionally, it needs to know about TZ. I can't find such a thing in joda-time, so I'm implementing my own. It looks like BasePartial is wrong because it throws out the TZ data. Any suggestions?

Mike


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing a non-local time of week

Matthew McCawley

Mike Craig <[hidden email]> wrote on 05/15/2012 06:59:00 PM:

> Additionally, it needs to know about TZ. I can't find such a thing
> in joda-time, so I'm implementing my own. It looks like BasePartial
> is wrong because it throws out the TZ data. Any suggestions?


Joda doesn't use the same TZ data as the JDK. Instead, it's compiled directly into the jar[0]. If you only use joda for time, then it doesn't matter, and in fact, it's better because Oracle's tzdata.jar releases can be several months behind the actual update so you can get the new update more quickly, but it does require more work. If you need to work with an existing codebase that uses Calendar and TimeZone, then you'll have to keep both updated to the same version. If JSR-310 is incorporated into Java 8, then it will use the same TZ data as the JDK.

Matthew McCawley

[0] http://joda-time.sourceforge.net/tz_update.html 
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Implementing a non-local time of week

jodastephen
In reply to this post by Mike Craig
On 15 May 2012 23:59, Mike Craig <[hidden email]> wrote:
> I need a ReadablePartial class that holds the fields dayOfWeek, hourOfDay,
> minuteOfHour, secondOfMinute, millisOfSecond. Additionally, it needs to know
> about TZ. I can't find such a thing in joda-time, so I'm implementing my
> own. It looks like BasePartial is wrong because it throws out the TZ data.
> Any suggestions?

BasePartial is intended for implementing "local" abstractions (just
date and time fields without time-zones). Since you're writing your
own class, you can store the time-zone yourself. Normally it is stored
in a ZonedChronology.

I would ask whether you have thought through your use case though. How
can a set of fields that only specified day-of-week down be used to
identify whether the date is in daylight savings or not?

Stephen

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...