Applies the local offset from UTC to each of the applicable time field values and returns the new Timestamp. In short, this makes the Timestamp represent local time. @return a new Timestamp in its local time
()
| 1234 | * @return a new Timestamp in its local time |
| 1235 | */ |
| 1236 | private Timestamp make_localtime() |
| 1237 | { |
| 1238 | int offset = _offset != null |
| 1239 | ? _offset.intValue() |
| 1240 | : 0; |
| 1241 | |
| 1242 | // We use a Copy-Constructor that expects the time parameters to be in |
| 1243 | // UTC, as that's what we're supposed to have. |
| 1244 | // As this Copy-Constructor doesn't apply local offset to the time |
| 1245 | // field values (it assumes that the local offset is already applied to |
| 1246 | // them), we explicitly apply the local offset to the time field values |
| 1247 | // after we obtain the new Timestamp instance. |
| 1248 | Timestamp localtime = new Timestamp(_precision, |
| 1249 | _year, |
| 1250 | _month, |
| 1251 | _day, |
| 1252 | _hour, |
| 1253 | _minute, |
| 1254 | _second, |
| 1255 | _fraction, |
| 1256 | _offset, |
| 1257 | APPLY_OFFSET_NO, |
| 1258 | CHECK_FRACTION_NO); |
| 1259 | // explicitly apply the local offset to the time field values |
| 1260 | localtime.apply_offset(-offset); |
| 1261 | |
| 1262 | assert localtime._offset == _offset; |
| 1263 | |
| 1264 | return localtime; |
| 1265 | } |
| 1266 | |
| 1267 | /** |
| 1268 | * Returns a Timestamp, precise to the year, with unknown local offset. |