634
635 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
636 if (tz == NULL) {
637 #else
638 #ifdef __solaris__
639 if (tz == NULL || *tz == '\0') {
640 #endif
641 #endif
642 tz = getPlatformTimeZoneID();
643 freetz = tz;
644 }
645
646 /*
647 * Remove any preceding ':'
648 */
649 if (tz != NULL && *tz == ':') {
650 tz++;
651 }
652
653 #ifdef __solaris__
654 if (strcmp(tz, "localtime") == 0) {
655 tz = getSolarisDefaultZoneID();
656 freetz = tz;
657 }
658 #endif
659
660 if (tz != NULL) {
661 #ifdef __linux__
662 /*
663 * Ignore "posix/" prefix.
664 */
665 if (strncmp(tz, "posix/", 6) == 0) {
666 tz += 6;
667 }
668 #endif
669 javatz = strdup(tz);
670 if (freetz != NULL) {
671 free((void *) freetz);
672 }
673 }
674 return javatz;
|
634
635 #if defined(__linux__) || defined(_ALLBSD_SOURCE)
636 if (tz == NULL) {
637 #else
638 #ifdef __solaris__
639 if (tz == NULL || *tz == '\0') {
640 #endif
641 #endif
642 tz = getPlatformTimeZoneID();
643 freetz = tz;
644 }
645
646 /*
647 * Remove any preceding ':'
648 */
649 if (tz != NULL && *tz == ':') {
650 tz++;
651 }
652
653 #ifdef __solaris__
654 if (tz != NULL && strcmp(tz, "localtime") == 0) {
655 tz = getSolarisDefaultZoneID();
656 freetz = tz;
657 }
658 #endif
659
660 if (tz != NULL) {
661 #ifdef __linux__
662 /*
663 * Ignore "posix/" prefix.
664 */
665 if (strncmp(tz, "posix/", 6) == 0) {
666 tz += 6;
667 }
668 #endif
669 javatz = strdup(tz);
670 if (freetz != NULL) {
671 free((void *) freetz);
672 }
673 }
674 return javatz;
|