Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository doesn't seem to be handling UTC unix timestamps correctly #14

Open
Dessix opened this issue Feb 8, 2016 · 5 comments
Open

Comments

@Dessix
Copy link
Member

Dessix commented Feb 8, 2016

Packages are always newer than themselves? Unsure what the cause is.

@clarkis117
Copy link
Collaborator

What are you using to timestamp?

@clarkis117
Copy link
Collaborator

Is this bit of code in question?

    [Route("/builds", "GET")]
    public class BuildListRequest : IReturn<List<Build>> {
        static BuildListRequest() {
            JsonSetup.Setup();
        }
        [DataMember(Name = "updatedAfter", IsRequired = false)]
        public String UpdatedAfterString { get; set; }

        [IgnoreDataMember]
        public DateTime? UpdatedAfter {
            get {
                if(UpdatedAfterString == null) {
                    return null;
                }
                return DateTime.SpecifyKind(long.Parse(this.UpdatedAfterString).FromUnixTimeStamp(), DateTimeKind.Utc);
            }
            set {
                if (!value.HasValue) {
                    UpdatedAfterString = null;
                    return;
                }
                value.Value.ToUnixTimeStamp();
            }
        }
    }

@clarkis117
Copy link
Collaborator

Confirmed this is the code in question

@Dessix
Copy link
Member Author

Dessix commented Feb 8, 2016

Importantly, DateTime.SpecifyKind makes a datetime ignore what type it thinks it was, effectively "shifting" the timezone without changing the raw value: instead of 17:00 at GMT-5 becoming 22:00 at GMT, SpecifyKind(..., DateTimeKind.Utc) makes it 17:00 at GMT. ToUniversalTime doesn't seem to effect Utc times, as they are already the correct type, but it will wind the clock in the opposite direction of the datetime shift when performed.

@Dessix Dessix self-assigned this Feb 8, 2016
@Dessix
Copy link
Member Author

Dessix commented Feb 9, 2016

This should be fixed in faff9a2, but I have yet to see for sure.

@Dessix Dessix removed their assignment Feb 10, 2016
@Dessix Dessix added the ready label Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants