Implement ISO9660 file record timestamp decoding.

This commit is contained in:
2019-07-19 14:59:35 +01:00
parent 67c23b2fab
commit 74a02a3194
3 changed files with 123 additions and 96 deletions

View File

@@ -4,6 +4,22 @@ namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660
{
DateTime DecodeIsoDateTime(byte[] date) => throw new NotImplementedException();
DateTime? DecodeIsoDateTime(IsoTimestamp timestamp)
{
try
{
DateTime date = new DateTime(timestamp.Years + 1900, timestamp.Month, timestamp.Day, timestamp.Hour,
timestamp.Minute, timestamp.Second, DateTimeKind.Unspecified);
date = date.AddMinutes(timestamp.GmtOffset * 15);
return TimeZoneInfo.ConvertTimeToUtc(date, TimeZoneInfo.FindSystemTimeZoneById("GMT"));
}
catch(Exception e)
{
// ISO says timestamp can be unspecified
return null;
}
}
}
}