SMB_DATE, SMB_TIME, UTime: Set DateTimeKind to Local

This commit is contained in:
Tal Aloni 2017-12-08 14:44:39 +02:00
parent 083d237ca6
commit 6d17dbabd6
2 changed files with 3 additions and 2 deletions

View file

@ -46,7 +46,8 @@ namespace SMBLibrary.SMB1
int year = ((value & 0xFE00) >> 9) + 1980; int year = ((value & 0xFE00) >> 9) + 1980;
int month = ((value & 0x01E0) >> 5); int month = ((value & 0x01E0) >> 5);
int day = (value & 0x001F); int day = (value & 0x001F);
return new DateTime(year, month, day); // SMB_DATE & SMB_TIME are represented in the local time zone of the server
return new DateTime(year, month, day, 0, 0, 0, DateTimeKind.Local);
} }
public static void WriteSMBDate(byte[] buffer, int offset, DateTime date) public static void WriteSMBDate(byte[] buffer, int offset, DateTime date)

View file

@ -16,7 +16,7 @@ namespace SMBLibrary.SMB1
/// </summary> /// </summary>
public class UTimeHelper public class UTimeHelper
{ {
public static readonly DateTime MinUTimeValue = new DateTime(1970, 1, 1); public static readonly DateTime MinUTimeValue = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local);
public static DateTime ReadUTime(byte[] buffer, int offset) public static DateTime ReadUTime(byte[] buffer, int offset)
{ {