Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
/coreclrPublic archive

Leap Seconds Support#21420

Merged
tarekgh merged 3 commits intodotnet:masterfromtarekgh:LeapSeconds
Dec 8, 2018
Merged

Leap Seconds Support#21420

tarekgh merged 3 commits intodotnet:masterfromtarekgh:LeapSeconds
Dec 8, 2018

Conversation

@tarekgh
Copy link
Member

Port the leap seconds changes done in the full framework to net core.

@tarekgh
Copy link
MemberAuthor

@jkotas this is just porting what we have done in the full framework. Also, I have created a commit for corert we can use when we are mirroring this change theretarekgh/corert@f79f7c8

could you please take a look at both and let me know if you have any comment? I have tested this on coreclr, corert and ProjectN native and Win32. I did the testing on Windows version which support leaps seconds with inserting some fake leap seconds to the system.

@jkotas
Copy link
Member

Is there going to be a matching PR with the tests in CoreFX?

@tarekgh
Copy link
MemberAuthor

Is there going to be a matching PR with the tests in CoreFX?

We already have tests for DateTime/DateTimeOffset exercise Now, UtcNow. Writing any test specific for testing with leap seconds will not have any effect because we'll have to run on a machine support leap seconds (i.e. RS5) and the system will have a leaps seconds which we don't have any so far. This will be interesting more when we get in the future a leap seconds.

@jkotas
Copy link
Member

We already have tests

There are two separate problems:

  1. Where/how/when we have machines with the right config available in automation. I understand that this may be not easy to solve momentarily. I assume that you got the right machine yourself.
  2. Tests that hit the new code on the machine with the right config. These tests should be failing before your change and passing after your change. This is the part that I think should be send to CoreFX.

@tarekgh
Copy link
MemberAuthor

Tests that hit the new code on the machine with the right config. These tests should be failing before your change and passing after your change. This is the part that I think should be send to CoreFX.

I'll write a test for that but I'll not expect this test will fail now and the possibility to fail in the future will be low. I understand your point and would be good to have it to catch if we would have a problem.

</ItemGroup>
<ItemGroupCondition="'$(TargetsWindows)' == 'true'">
<CompileInclude="$(BclSourcesRoot)\System\DateTime.Windows.cs" />
<CompileInclude="shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This should be in the project in the shared partition


[MethodImplAttribute(MethodImplOptions.InternalCall)]
internalstaticexternboolSystemTimeToSystemFileTime(refFullSystemTimetime,reflongfileTime);
internalstaticexternboolSystemTimeToSystemFileTime(refInterop.Kernel32.SYSTEMTIMEtime,outlongfileTime);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The first argument can bein Interop.Kernel32.SYSTEMTIME


[DllImport(JitHelpers.QCall,CharSet=CharSet.Unicode)]
internalstaticexternboolIsLeapSecondsSupportedSystem();
internalstaticexternboolValidateSystemTime(refInterop.Kernel32.SYSTEMTIMEtime,boollocalTime);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The first argument can bein

FullSystemTimetime=newFullSystemTime();
if(SystemFileTimeToSystemTime(fileTime,reftime))
FullSystemTimetime;
if(SystemFileTimeToSystemTime(fileTime,outtime))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nit:if (SystemFileTimeToSystemTime(fileTime, out FullSystemTime time))

longfileTime;
FullSystemTimetime=newFullSystemTime(ticks);
if(SystemTimeToSystemFileTime(reftime,reffileTime))
if(SystemTimeToSystemFileTime(reftime.systemTime,outfileTime))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nit:if (SystemTimeToSystemFileTime(ref time.systemTime, out long fileTime))

internalstaticexternboolValidateSystemTime(refInterop.Kernel32.SYSTEMTIMEtime,boollocalTime);

[MethodImplAttribute(MethodImplOptions.InternalCall)]
internalstaticexternboolSystemFileTimeToSystemTime(longfileTime,outFullSystemTimetime);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is there a reason why we call some of these thingsSystemFileTime? There isSYSTEMTIME andFILETIME today, but there is no SystemFileTime today.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I was trying to have it clear FILETIME is always a system file time. if you think this is confusing, I can change it.

{
FCALL_CONTRACT;

if (::SystemTimeToFileTime(time, (LPFILETIME) pFileTime))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This does not need if - can just return the value returned by SystemTimeToFileTime.

BOOL ret = ::SystemTimeToFileTime(...FC_RETURN_BOOL(ret);

returnnewDateTime(universalTicks,DateTimeKind.Utc);
}

publiclongToFileTimeUtc(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nit:{ should be on a new line

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Those was a copy and paste from other file. I'll fix them.

}

ticks-=FileTimeOffset;
if(ticks<0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same

hundredNanoSecond=0;
}

internalInterop.Kernel32.SYSTEMTIMEsystemTime;
Copy link
Member

@jkotasjkotasDec 8, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The coding convention is to place the fields first.

}
}

publicstaticDateTimeFromFileTimeUtc(longfileTime)
Copy link
Member

@jkotasjkotasDec 8, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The only difference between Windows and Unix versions of FromFileTimeUtc and ToFileTimeUtc is the callout to the special method method for leap seconds. Should we have keep it in the shared and have a dummy method on Unix?

Also, it may be better to call InternalFromFileTime / InternalToFileTime something likeFromFileTimeUtcLeapSecondsAware / ToFileTimeUtcLeapSecondAware.

@jkotas
Copy link
Member

Do you have the number for performance hit that the methods likeDateTime.UtcNow will incur on the leap second aware systems with this change?

I think we had it in one of the offline conversations ... it would be useful to have the number on here too.

@jkotas
Copy link
Member

Looks good to me otherwise

@tarekgh
Copy link
MemberAuthor

Do you have the number for performance hit that the methods like DateTime.UtcNow will incur on the leap second aware systems with this change?

I don't have the exact numbers here and also I am using a VM for my leap seconds testing. but I have tested it and we always reporting the time on the same milliseconds boundary. Here example for what I was doing:

SYSTEMTIMEst=newSYSTEMTIME();GetSystemTime(refst);DateTimedt=DateTime.UtcNow;Console.WriteLine($"<{st.wHour:D2}:{st.wMinute:D2}:{st.wSecond:D2}.{st.wMillisecond:D2}> .... [{dt.Hour:D2}:{dt.Minute:D2}:{dt.Second:D2}.{dt.Millisecond:D2}]");

Note that we still reporting the precise time as we used to do even in leap seconds system. the only extra perf is just the time we use till we return. I can do the measurements later to get the exact numbers. note that we already have a perf tests for this too. anyway, let me know if you want to wait not merging the change till we do that or we case merge and do the measurements later. if we want to wait, I'll hold this changes till next year.

@jkotas
Copy link
Member

let me know if you want to wait not merging the change till we do that

I do not think you need to block on this.

@tarekgh
Copy link
MemberAuthor

test Windows_NT x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0)

@tarekgh
Copy link
MemberAuthor

thanks@jkotas for your review and comments. I will wait preparing the changes for corert too and test it so we'll be ready when we merge. I'll let you know when I have it ready to take a quick look there too.

@tarekgh
Copy link
MemberAuthor

here is the delta changes in corert repo tootarekgh/corert@b503742 i have tested it with PN too. after reviewing the delta, I'll squash moth commits in corert to one so it will be easy to use.

@tarekgh
Copy link
MemberAuthor

Thanks a lot@jkotas for your review. I have updated the corert too and squashed the commits into one committarekgh/corert@389615a

@tarekghtarekgh merged commit98e4995 intodotnet:masterDec 8, 2018
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corefx that referenced this pull requestDec 8, 2018
* Leap Seconds Support* Address Feedback* More feedback addressingSigned-off-by: dotnet-bot <dotnet-bot@microsoft.com>
@tarekgh
Copy link
MemberAuthor

I added a comment too on corert changetarekgh/corert@389615a#r31609074 may be we need to apply.

stephentoub pushed a commit to dotnet/corefx that referenced this pull requestDec 9, 2018
* Leap Seconds Support* Address Feedback* More feedback addressingSigned-off-by: dotnet-bot <dotnet-bot@microsoft.com>
@tarekgh
Copy link
MemberAuthor

@Anipik I am noticing there is no corert mirroring PR opened for this one. Is it expected?

@Anipik
Copy link

@tarekgh it is expected in the sense that there can be only one open mirror pr in a repo at any time.
And we have already have one in corert which hasnt yet mergeddotnet/corert#6663
After this PR has been merged the next pr for corert repo will contain this commit

jkotas reacted with thumbs up emoji

@tarekgh
Copy link
MemberAuthor

Thanks@Anipik

Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull requestDec 10, 2018
* Leap Seconds Support* Address Feedback* More feedback addressingSigned-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corert that referenced this pull requestDec 10, 2018
* Leap Seconds Support* Address Feedback* More feedback addressingSigned-off-by: dotnet-bot <dotnet-bot@microsoft.com>
morganbr pushed a commit that referenced this pull requestDec 14, 2018
* Leap Seconds Support* Address Feedback* More feedback addressing
jlennox pushed a commit to jlennox/corefx that referenced this pull requestDec 16, 2018
* Leap Seconds Support* Address Feedback* More feedback addressingSigned-off-by: dotnet-bot <dotnet-bot@microsoft.com>
@tarekghtarekgh deleted the LeapSeconds branchMarch 25, 2019 15:30
picenka21 pushed a commit to picenka21/runtime that referenced this pull requestFeb 18, 2022
* Leap Seconds Support* Address Feedback* More feedback addressingCommit migrated fromdotnet/coreclr@98e4995
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

2 more reviewers

@danmoseleydanmoseleydanmoseley left review comments

@jkotasjkotasjkotas approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@tarekgh@jkotas@Anipik@danmoseley

[8]ページ先頭

©2009-2025 Movatter.jp