From a063ac04dc0d3cc3d9a1ecf77e7bad0b143f899c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 7 Aug 2016 04:35:32 +0100 Subject: [PATCH] * README.md: * DiscImageChef.DiscImages/CopyQM.cs: * DiscImageChef.DiscImages/DiscImageChef.DiscImages.csproj: Added support for Sydex CopyQM disk image format. * DiscImageChef.CommonTypes/MediaType.cs: Corrected typo. * DiscImageChef.DiscImages/DiskCopy42.cs: Misplacement of XML media type setting. * DiscImageChef.Helpers/DateHandlers.cs: Added DOS to C# date converter. --- ChangeLog | 4 ++++ DateHandlers.cs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 477776b..8fb99fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-08-07 Natalia Portillo + + * DateHandlers.cs: Added DOS to C# date converter. + 2016-08-01 Natalia Portillo * AssemblyInfo.cs: diff --git a/DateHandlers.cs b/DateHandlers.cs index fef5624..9ada511 100644 --- a/DateHandlers.cs +++ b/DateHandlers.cs @@ -150,6 +150,20 @@ namespace DiscImageChef DicConsole.DebugWriteLine("UCSDPascalToDateTime handler", "dateRecord = 0x{0:X4}, year = {1}, month = {2}, day = {3}", dateRecord, year, month, day); return new DateTime(year, month, day); } + + public static DateTime DOSToDateTime(ushort date, ushort time) + { + int year = ((date & 0xFE00) >> 9) + 1980; + int month = (date & 0x1E0) >> 5; + int day = date & 0x1F; + int hour = (time & 0xF800) >> 11; + int minute = (time & 0x7E0) >> 5; + int second = (time & 0x1F) * 2; + + DicConsole.DebugWriteLine("DOSToDateTime handler", "date = 0x{0:X4}, year = {1}, month = {2}, day = {3}", date, year, month, day); + DicConsole.DebugWriteLine("DOSToDateTime handler", "time = 0x{0:X4}, hour = {1}, minute = {2}, second = {3}", time, hour, minute, second); + return new DateTime(year, month, day, hour, minute, second); + } } }