Skip to content

Commit

Permalink
Fix #7236.
Browse files Browse the repository at this point in the history
Former-commit-id: 8b24b3343903bae2826e49de5005c8f38941da57
  • Loading branch information
ylangisc committed May 23, 2013
1 parent f49d26e commit ec09a74
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
11 changes: 9 additions & 2 deletions source/ch/cyberduck/ui/controller/InfoController.cs
Expand Up @@ -24,6 +24,7 @@
using System.Windows.Forms;
using Ch.Cyberduck.Core;
using Ch.Cyberduck.Ui.Controller.Threading;
using Ch.Cyberduck.Ui.Winforms;
using StructureMap;
using ch.cyberduck.core;
using ch.cyberduck.core.cdn;
Expand Down Expand Up @@ -1068,7 +1069,10 @@ private void InitGeneral()
else
{
View.Modified =
UserDateFormatterFactory.get().getLongFormat(file.attributes().getModificationDate());
UserDateFormatterFactory.get()
.getLongFormat(
UserDefaultsDateFormatter.ConvertJavaMillisecondsToDotNetMillis(
file.attributes().getModificationDate()));
}
if (-1 == file.attributes().getCreationDate())
{
Expand All @@ -1077,7 +1081,10 @@ private void InitGeneral()
else
{
View.FileCreated =
UserDateFormatterFactory.get().getLongFormat(file.attributes().getModificationDate());
UserDateFormatterFactory.get()
.getLongFormat(
UserDefaultsDateFormatter.ConvertJavaMillisecondsToDotNetMillis(
file.attributes().getModificationDate()));
}
}
View.FileOwner = count > 1
Expand Down
9 changes: 7 additions & 2 deletions source/ch/cyberduck/ui/controller/ProgressController.cs
@@ -1,5 +1,5 @@
//
// Copyright (c) 2010-2012 Yves Langisch. All rights reserved.
// Copyright (c) 2010-2013 Yves Langisch. All rights reserved.
// http://cyberduck.ch/
//
// This program is free software; you can redistribute it and/or modify
Expand All @@ -20,6 +20,7 @@
using System.Collections.Generic;
using Ch.Cyberduck.Core;
using Ch.Cyberduck.Ui.Controller.Threading;
using Ch.Cyberduck.Ui.Winforms;
using Ch.Cyberduck.Ui.Winforms.Controls;
using StructureMap;
using ch.cyberduck.core;
Expand Down Expand Up @@ -152,7 +153,11 @@ private void SetMessageText()
Date timestamp = _transfer.getTimestamp();
if (null != timestamp)
{
_messageText = UserDateFormatterFactory.get().getLongFormat(timestamp.getTime());
_messageText =
UserDateFormatterFactory.get()
.getLongFormat(
UserDefaultsDateFormatter.ConvertJavaMillisecondsToDotNetMillis(
timestamp.getTime()));
}
}
if (null != _messageText)
Expand Down
12 changes: 8 additions & 4 deletions source/ch/cyberduck/ui/controller/TransferPromptController.cs
@@ -1,5 +1,5 @@
//
// Copyright (c) 2010-2012 Yves Langisch. All rights reserved.
// Copyright (c) 2010-2013 Yves Langisch. All rights reserved.
// http://cyberduck.ch/
//
// This program is free software; you can redistribute it and/or modify
Expand All @@ -20,6 +20,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using Ch.Cyberduck.Core;
using Ch.Cyberduck.Ui.Winforms;
using StructureMap;
using ch.cyberduck.core;
using ch.cyberduck.core.date;
Expand All @@ -29,7 +30,6 @@
using ch.cyberduck.core.transfer.download;
using ch.cyberduck.core.transfer.synchronisation;
using ch.cyberduck.core.transfer.upload;
using ch.cyberduck.ui.controller;
using org.apache.log4j;

namespace Ch.Cyberduck.Ui.Controller
Expand Down Expand Up @@ -165,8 +165,12 @@ private void View_ChangedSelectionEvent()
else
{
View.LocalFileModificationDate =
UserDateFormatterFactory.get().getLongFormat(
selected.getLocal().attributes().getModificationDate());
UserDateFormatterFactory.get()
.getLongFormat(UserDefaultsDateFormatter
.ConvertJavaMillisecondsToDotNetMillis(
selected.getLocal()
.attributes()
.getModificationDate()));
}

View.RemoteFileUrl = selected.toURL(false);
Expand Down
8 changes: 8 additions & 0 deletions source/ch/cyberduck/ui/winforms/UserDefaultsDateFormatter.cs
Expand Up @@ -76,6 +76,14 @@ public static DateTime ConvertJavaMillisecondsToDateTime(long javaMS)
return dt;
}

public static long ConvertJavaMillisecondsToDotNetMillis(long javaMS)
{
DateTime utcBaseTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime dt = utcBaseTime.Add(new TimeSpan(javaMS*
TimeSpan.TicksPerMillisecond)).ToLocalTime();
return dt.Ticks/TimeSpan.TicksPerMillisecond;
}

private class Factory : UserDateFormatterFactory
{
protected override object create()
Expand Down

0 comments on commit ec09a74

Please sign in to comment.