News:

Facebook killed the radio star. And by radio star, I mean the premise of distributed forums around the internet. And that got got by Instagram/SnapChat. And that got got by TikTok. Where the fuck is the internet we once knew?

Main Menu

[Java] Converting Windows FileTimes to java.lang.Dates

Started by Camel, November 01, 2007, 03:37:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Camel

If you live in a DST observing timezone, these numbers will be one hour off this week. This appears to be a bug with Java not respecting the new DST rules.

Funny how we'll throw an entire week in to chaos to avoid two hours of confusion during a time when normal people are asleep.

/**
* Converts a Windows FileTime structure to a Date
* @param ft contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
* @return a Date with the correct time
*/
public static Date fileTime(long ft) {
// Date.parse("1/1/1601") == 11644455600000L
long date = ft / 10000 - 11644455600000L;
date += TimeZone.getDefault().getOffset(date);
return new Date(date);
}

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Chavo

DST is retarded anyway :/  The primary cause for it's use to begin with isn't even necessary anymore.

iago

Quote from: Chavo on November 01, 2007, 05:03:30 PM
DST is retarded anyway :/  The primary cause for it's use to begin with isn't even necessary anymore.
You mean to encourage people to shop for an extra hour during the summer? 

Or is that just the conspiracy theory? :)

Skywing

Quote from: Chavo on November 01, 2007, 05:03:30 PM
DST is retarded anyway :/  The primary cause for it's use to begin with isn't even necessary anymore.

I'm not all that enthusiastic about DST either, but the reasons for it are certainly still relevant today with continually rising energy prices.

Chavo

Quote from: Skywing on November 01, 2007, 08:30:32 PM
I'm not all that enthusiastic about DST either, but the reasons for it are certainly still relevant today with continually rising energy prices.
Energy savings were shown in multiple cases to be negligible or just plain not there.

http://www.env-econ.net/2007/03/are_daylight_sa.html
http://www.ucei.berkeley.edu/PDF/csemwp163.pdf

QuoteYou mean to encourage people to shop for an extra hour during the summer?
No, to give farmers an extra hour of daylight to match up with the economy's trading hours.