Git Product home page Git Product logo

Comments (10)

yandy avatar yandy commented on June 15, 2024

+1

from rugged.

vmg avatar vmg commented on June 15, 2024

Time#mktime method should allow creating new Time objects with a specified tz.

Not under 1.8.7; this only applies to 1.9+. What should I do with the old Ruby? I don't see any way of defining a timezone, besides local and UTC.

from rugged.

carlosmn avatar carlosmn commented on June 15, 2024

FWIW pygit2 exposes it as part of the author information so you access it with commit.author.offset.

from rugged.

vmg avatar vmg commented on June 15, 2024

I see. That may be a valid approach in 1.8.7, whilst in 1.9.2 we could set the offset properly in the Time object... Although I don't like the idea of having different APIs based on the version.

This ought to be a solved problem... I can't believe that 1.8.7 doesn't have proper support for timezones.

from rugged.

rtomayko avatar rtomayko commented on June 15, 2024

Yeah I'm totally baffled by not being able to create Time objects with a custom timezone in 1.8.7. I thought Grit gave back proper time objects but its ignoring the timezone entirely and uses the unix time.

I guess I like the idea of always using UTC in 1.8.7 and exposing the zone offset separately.

An alternate approach would be to expose to an ISO8601 string version of the timestamp in addition to the time object.

from rugged.

vmg avatar vmg commented on June 15, 2024

Gotcha. Do you want proper timezones in 1.9, though? Or would you rather keep the API consistent?

from rugged.

rtomayko avatar rtomayko commented on June 15, 2024

So at this point I really don't even care about the Time object. I just want an ISO8601 string representation that retains the original time zone info. This can be a totally separate accessor. Right now we're just converting the Time object into an ISO8601 string anyway so all this round-trip through Time is doing is losing data.

from rugged.

nulltoken avatar nulltoken commented on June 15, 2024

tl;dr; The offset can not always be resolved to a timezone.

The offset is the number of minutes from UTC, including the daylight saving time policy at this date.

This means:

  • Some different timezones may share the same offset at some point in the year
  • The same timezone may have a different offset along the year

from rugged.

rtomayko avatar rtomayko commented on June 15, 2024

That's fine. I need the information that's in the commit. I can establish time of day and approximate timezone at least.

This is really so fundamental. It should always be possible to recreate the exact same object from the data libgit2/rugged exposes. I should be able to take the information exposed by these interfaces and recreate the raw objects and have them checksum down to the same sha1. This is a really simple and important stick to measure against. If you can't recreate the object data, then I'd say it should be classified as a bug.

As of right now it's impossible to generate a same commit object from the information exposed by Rugged.

from rugged.

rtomayko avatar rtomayko commented on June 15, 2024

Fixed in #158

from rugged.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.