Skip to content

Commit

Permalink
winzone support added
Browse files Browse the repository at this point in the history
  • Loading branch information
MenoData committed May 13, 2019
1 parent d546a25 commit be72358
Show file tree
Hide file tree
Showing 6 changed files with 893 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/java/de/menodata/timedemoapp/TimeDemoApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
import net.time4j.format.expert.ChronoFormatter;
import net.time4j.format.expert.PatternType;
import net.time4j.i18n.IsoTextProviderSPI;
import net.time4j.tz.NameStyle;
import net.time4j.tz.TZID;
import net.time4j.tz.Timezone;
import net.time4j.tz.ZonalOffset;
import net.time4j.tz.olson.EUROPE;
import net.time4j.tz.other.WindowsZone;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -169,6 +171,15 @@ static String getTimeInfo(Context context) {
Locale.GERMAN,
BadiCalendar.axis());

try {
TZID winzoneID = WindowsZone.of("Romance Standard Time").resolveSmart(Locale.FRANCE);
WindowsZone.registerAsTimezone();
String winzoneName = Timezone.of(winzoneID).getDisplayName(NameStyle.LONG_STANDARD_TIME, Locale.FRANCE);
Log.i("TIME4A", "Winzone: " + winzoneID.canonical() + "=>" + winzoneName);
} catch (IllegalArgumentException ex) {
Log.e("TIME4A", "Winzone not known.");
}

return "\n\n\n\n"
+ "=> Current time (UTC): " + moment.toString()
+ "\n"
Expand Down
Binary file not shown.

1 comment on commit be72358

@MenoData
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.