diff options
| author | 2011-03-27 22:58:35 +0200 | |
|---|---|---|
| committer | 2011-03-27 22:58:35 +0200 | |
| commit | 328030119b24951462a95079fd1a268a5ff9f3d0 (patch) | |
| tree | 1509b54eeb124cfc054203faf4455867308f04f4 /tools | |
| parent | 4910673fea64fc189e190e2039e869b9d6542e02 (diff) | |
| download | libimobiledevice-328030119b24951462a95079fd1a268a5ff9f3d0.tar.gz libimobiledevice-328030119b24951462a95079fd1a268a5ff9f3d0.tar.bz2 | |
idevicedate: Rip out all timezone correction code which appears obsolete
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/idevicedate.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/tools/idevicedate.c b/tools/idevicedate.c index b3e7334..e4e0a33 100644 --- a/tools/idevicedate.c +++ b/tools/idevicedate.c | |||
| @@ -63,11 +63,9 @@ int main(int argc, char *argv[]) | |||
| 63 | uuid[0] = 0; | 63 | uuid[0] = 0; |
| 64 | uint64_t datetime = 0; | 64 | uint64_t datetime = 0; |
| 65 | time_t rawtime; | 65 | time_t rawtime; |
| 66 | double offset_from_utc = 0.0; | ||
| 67 | struct tm * tmp; | 66 | struct tm * tmp; |
| 68 | char const *format = NULL; | 67 | char const *format = NULL; |
| 69 | char buffer[80]; | 68 | char buffer[80]; |
| 70 | int tzshift = 0; | ||
| 71 | 69 | ||
| 72 | /* parse cmdline args */ | 70 | /* parse cmdline args */ |
| 73 | for (i = 1; i < argc; i++) { | 71 | for (i = 1; i < argc; i++) { |
| @@ -96,7 +94,6 @@ int main(int argc, char *argv[]) | |||
| 96 | print_usage(argc, argv); | 94 | print_usage(argc, argv); |
| 97 | return 0; | 95 | return 0; |
| 98 | } | 96 | } |
| 99 | tzshift = 1; | ||
| 100 | continue; | 97 | continue; |
| 101 | } | 98 | } |
| 102 | else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--sync")) { | 99 | else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--sync")) { |
| @@ -106,8 +103,7 @@ int main(int argc, char *argv[]) | |||
| 106 | /* convert it to local time which sets timezone/daylight variables */ | 103 | /* convert it to local time which sets timezone/daylight variables */ |
| 107 | tmp = localtime(&setdate); | 104 | tmp = localtime(&setdate); |
| 108 | /* recalculate to make it UTC */ | 105 | /* recalculate to make it UTC */ |
| 109 | setdate = mktime(tmp) - timezone - (daylight ? 3600 : 0 ); | 106 | setdate = mktime(tmp); |
| 110 | tzshift = 0; | ||
| 111 | continue; | 107 | continue; |
| 112 | } | 108 | } |
| 113 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { | 109 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { |
| @@ -149,15 +145,6 @@ int main(int argc, char *argv[]) | |||
| 149 | return -1; | 145 | return -1; |
| 150 | } | 146 | } |
| 151 | 147 | ||
| 152 | /* read timezone offset of device, needed for conversions */ | ||
| 153 | if (lockdownd_get_value(client, NULL, "TimeZoneOffsetFromUTC", &node) == LOCKDOWN_E_SUCCESS) { | ||
| 154 | if (node) { | ||
| 155 | plist_get_real_val(node, &offset_from_utc); | ||
| 156 | plist_free(node); | ||
| 157 | node = NULL; | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 161 | /* get or set? */ | 148 | /* get or set? */ |
| 162 | if (setdate == 0) { | 149 | if (setdate == 0) { |
| 163 | /* get time value from device */ | 150 | /* get time value from device */ |
| @@ -170,7 +157,6 @@ int main(int argc, char *argv[]) | |||
| 170 | /* date/time calculations */ | 157 | /* date/time calculations */ |
| 171 | rawtime = (time_t)datetime; | 158 | rawtime = (time_t)datetime; |
| 172 | tmp = localtime(&rawtime); | 159 | tmp = localtime(&rawtime); |
| 173 | tmp->tm_gmtoff = offset_from_utc; | ||
| 174 | 160 | ||
| 175 | /* finally we format and print the current date */ | 161 | /* finally we format and print the current date */ |
| 176 | strftime(buffer, 80, format, tmp); | 162 | strftime(buffer, 80, format, tmp); |
| @@ -178,10 +164,6 @@ int main(int argc, char *argv[]) | |||
| 178 | } | 164 | } |
| 179 | } | 165 | } |
| 180 | } else { | 166 | } else { |
| 181 | if (tzshift) { | ||
| 182 | /* if we had provided a timestamp and have to adjust according to the device's timezone */ | ||
| 183 | setdate = setdate - offset_from_utc; | ||
| 184 | } | ||
| 185 | datetime = setdate; | 167 | datetime = setdate; |
| 186 | 168 | ||
| 187 | if(lockdownd_set_value(client, NULL, "TimeIntervalSince1970", plist_new_uint(datetime)) == LOCKDOWN_E_SUCCESS) { | 169 | if(lockdownd_set_value(client, NULL, "TimeIntervalSince1970", plist_new_uint(datetime)) == LOCKDOWN_E_SUCCESS) { |
