# ThreeTenABP **Repository Path**: anydev/ThreeTenABP ## Basic Information - **Project Name**: ThreeTenABP - **Description**: ThreeTenABP 是一个专门为Android平台设计的时间日期库,它提供了对Java 8中JSR-310 API的兼容支持。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: trunk - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-22 - **Last Updated**: 2025-01-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## 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.7' ``` 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 at http://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/