Closed
Description
Description
Interrogate an s3 bucket using the AWSSDK.S3 C# nuget package, the LastModifed times you get back are not in UTC (GMT). The times are in fact in some unknown timezone.
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/TS3Object.html
Reproduction Steps
Query a bucket and some file from two different regions, if the time was truly in UTC then the LastModified value would be the same. Here is the code where I print the times out of some bucket.
foreach (S3Object entry in filter_objects)
...
...
if ((DateTime.Today - dt).Days < 15)
{
_log.Warn($"RECENT ONETICK FILE -- date = {dt.ToString("dd-MMM-yy")}, filename = {entry.Key}, size = {entry.Size.ToString().PadRight(10)}, uploaded on = {entry.LastModified.ToString("dd-MMM-yy HH:mm", CultureInfo.InvariantCulture)} (UTC time) ");
Thread.Sleep(50); // Just to help with the logging order.
}
Logs
here I am running the code in London
2021-07-20 12:32:13,475 191 [1] WARN OneTick.OneTick_Backfiller (null) - ################################################################
2021-07-20 12:32:13,538 255 [1] WARN OneTick.OneTick_Backfiller (null) - Starting OneTick.OneTick_Backfiller
2021-07-20 12:32:13,541 257 [1] WARN OneTick.OneTick_Backfiller (null) - ################################################################
2021-07-20 12:32:13,543 259 [1] WARN OneTick.OneTick_Backfiller (null) - Current time zone = GMT Standard Time
2021-07-20 12:32:13,546 262 [1] WARN OneTick.OneTick_Backfiller (null) - Local time is now : 20-Jul-21 12:32
2021-07-20 12:32:13,548 264 [1] WARN OneTick.OneTick_Backfiller (null) - UTC time is now : 20-Jul-21 11:32
2021-07-20 12:32:14,017 733 [1] WARN OneTick.s3_Interrogator (null) - ******************** Interrogating at the ONETICK s3 bucket ********************
2021-07-20 12:32:26,113 12830 [1] WARN OneTick.s3_Interrogator (null) - RECENT ONETICK FILE -- date = 06-Jul-21, filename = caxton-bars/out/caxton_bars_last_5_days_20210706.csv.gz, size = 113401744 , uploaded on = 07-Jul-21 07:40 (UTC time)
And here in the US
2021-07-20 07:36:48,997 254 [1] WARN OneTick.OneTick_Backfiller (null) - ################################################################
2021-07-20 07:36:49,086 343 [1] WARN OneTick.OneTick_Backfiller (null) - Starting OneTick.OneTick_Backfiller
2021-07-20 07:36:49,105 362 [1] WARN OneTick.OneTick_Backfiller (null) - ################################################################
2021-07-20 07:36:49,112 369 [1] WARN OneTick.OneTick_Backfiller (null) - Current time zone = Eastern Standard Time
2021-07-20 07:36:49,113 370 [1] WARN OneTick.OneTick_Backfiller (null) - Local time is now : 20-Jul-21 07:36
2021-07-20 07:36:49,114 371 [1] WARN OneTick.OneTick_Backfiller (null) - UTC time is now : 20-Jul-21 11:36
2021-07-20 07:36:49,642 899 [1] WARN OneTick.s3_Interrogator (null) - ******************** Interrogating at the ONETICK s3 bucket ********************
2021-07-20 07:36:50,917 2174 [1] WARN OneTick.s3_Interrogator (null) - RECENT ONETICK FILE -- date = 06-Jul-21, filename = caxton-bars/out/caxton_bars_last_5_days_20210706.csv.gz, size = 113401744 , uploaded on = 07-Jul-21 02:40 (UTC time)
Note how the last modified time is different by five hours. So it is not GMT, but in some unknown timezone. If I at least knew the timezone I could convert it to GMT.
Environment
<PackageReference Include="AWSSDK.S3" Version="3.7.1.14" />
<TargetFramework>netstandard2.0</TargetFramework>
Windows 10
Resolution
This is a 🐛 bug-report