Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JakeWharton/ThreeTenABP
An adaptation of the JSR-310 backport for Android.
https://github.com/JakeWharton/ThreeTenABP
Last synced: about 1 month ago
JSON representation
An adaptation of the JSR-310 backport for Android.
- Host: GitHub
- URL: https://github.com/JakeWharton/ThreeTenABP
- Owner: JakeWharton
- License: apache-2.0
- Created: 2015-07-03T17:35:09.000Z (over 9 years ago)
- Default Branch: trunk
- Last Pushed: 2024-11-26T15:27:47.000Z (about 2 months ago)
- Last Synced: 2024-12-03T06:07:23.882Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 413 KB
- Stars: 3,552
- Watchers: 56
- Forks: 133
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-android - ThreeTen Android Backport - An adaptation of the JSR-310 backport for Android. (Libraries / Date & Time)
- awesome-android-libraries - ThreeTenABP - 310 backport for Android (Time)
- awesome-android - ThreeTen Android Backport - An adaptation of the JSR-310 backport for Android. (Libraries / Date & Time)
README
ThreeTen Android Backport
=========================An adaptation of the JSR-310 backport for Android.
**Attention**: Development on this library is winding down. Please consider switching to
Android Gradle plugin 4.0, `java.time.*`, and its
[core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) feature
in the coming months.Usage
-----Initialize the timezone information in your `Application.onCreate()` method:
```java
@Override public void onCreate() {
super.onCreate();
AndroidThreeTen.init(this);
}
```That's it. Otherwise usage is the exact same as the ThreeTenBP library and you should consult
its website for usage information: https://www.threeten.org/threetenbp/.Why JSR-310?
------------JSR-310 was included in Java 8 as [the `java.time.*` package][time]. It is a full replacement
for the ailing `Date` and `Calendar` APIs in both Java and Android. JSR-310 was backported to
Java 6 by its creator, Stephen Colebourne, from which this library is adapted.Why not use ThreeTenBP?
-----------------------Similar to the problems with using [Joda-Time on Android][joda-android], the [threetenbp][ttbp]
uses a JAR resource for loading timezone information. This is an extremely [inefficient mechanism
on Android][slow].This library places the timezone information as a standard Android asset and provides a custom
loader for parsing it efficiently.Why not use Joda-Time?
----------------------Joda-Time has a very large API which brings with it a very large binary size and large method
count. The creator of both JSR-310 and Joda-Time has also said that while Joda-Time isn't broken,
it does [have design flaws][flaws].If you are using Joda-Time already, there's little reason to switch unless its size or method
count is relevant to you. For new projects, however, this library offers the standard APIs in
Java 8 as a much smaller package in not only binary size and method count, but also in API size.Download
--------```groovy
implementation 'com.jakewharton.threetenabp:threetenabp:1.4.8'
```Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap].
License
-------Copyright (C) 2015 Jake Wharton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.[snap]: https://oss.sonatype.org/content/repositories/snapshots/
[time]: https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html
[joda-android]: https://github.com/dlew/joda-time-android#why-this-library
[ttbp]: https://github.com/ThreeTen/threetenbp
[flaws]: http://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html
[slow]: http://blog.danlew.net/2013/08/20/joda_time_s_memory_issue_in_android/