Getting Started for Contributing to this Repo

20 views
Skip to first unread message

Bishwajeet Parhi

unread,
May 22, 2021, 2:29:44 PM5/22/21
to cctz
Hey, Bishwajeet this side,  Currently an undergrad student . I found this organization from the opensource google website and found this repo quite interesting. On going through the readme docs you wanted to run the cctz library in windows platform. I want to contribute to this . Can anyone guide me on how to get started ??

Thanks in advance
Bishwajeet

Bradley White

unread,
May 24, 2021, 1:02:24 AM5/24/21
to Bishwajeet Parhi, cctz
On Sat, May 22, 2021 at 2:29 PM Bishwajeet Parhi <bishwajeet...@gmail.com> wrote:
Hey, Bishwajeet this side,  Currently an undergrad student . I found this organization from the opensource google website and found this repo quite interesting. On going through the readme docs you wanted to run the cctz library in windows platform. I want to contribute to this . Can anyone guide me on how to get started ??

Hi Bishwajeet.  Thanks for contacting us and offering to help.

On the Windows front we are mostly looking for an implementation of the cctz::TimeZoneIf interface from src/time_zone_if.h:

class TimeZoneIf {
 public:
  // A factory function for TimeZoneIf implementations.
  static std::unique_ptr<TimeZoneIf> Load(const std::string& name);

  virtual ~TimeZoneIf();

  virtual time_zone::absolute_lookup BreakTime(
      const time_point<seconds>& tp) const = 0;
  virtual time_zone::civil_lookup MakeTime(
      const civil_second& cs) const = 0;

  virtual bool NextTransition(const time_point<seconds>& tp,
                              time_zone::civil_transition* trans) const = 0;
  virtual bool PrevTransition(const time_point<seconds>& tp,
                              time_zone::civil_transition* trans) const = 0;

  virtual std::string Version() const = 0;
  virtual std::string Description() const = 0;
};

It should be able to support at least the BreakTime() and MakeTime() functions using only the Windows runtime library (i.e., without the need to to install the "zoneinfo" data files).  These functions provide the mappings between civil and absolute times for a timezone.

NextTransition() and PrevTransition() would be nice to have.  The strings returned by Version() and Description() could be defined appropriately by the implementation.

The cctz::TimeZoneIf::Load() factory in src/time_zone_if.cc could then be taught how to create instances of this new implementation.  It would be best if the naming of timezones (the argument to Load())  was independent of the TimeZoneIf implementation (i.e., if Windows could use the same IANA TZ names).

A proof of concept would be being able to run the src/time_tool.cc command-line program on a Windows machine.

Does that help?  We are more than happy to discuss further, and to get to more specifics, if/when you'd like to proceed.

Thanks.

Bishwajeet Parhi

unread,
May 26, 2021, 4:31:42 AM5/26/21
to cctz
Hey, Thanks for the follow-up . I need some help regarding setting up repo in my machine . As given in the readme files , one can either use bazel or cmake to build cctz library. I tried to install bazel but I couldn't in my device. so I used Cmake instead. Now while running the commands , I received some following error related to google-test ( I have attached the following log files in this thread).

Also , I went through the codebase and tried to understand what is being done actually. I have some doubts, Why this library doesn't work without zoneinfo files in the windows platform?? 

CMakeError.log
CMakeOutput.log

Bradley White

unread,
May 26, 2021, 2:57:54 PM5/26/21
to Bishwajeet Parhi, cctz
Hi Bishwajeet,

On Wed, May 26, 2021 at 4:31 AM Bishwajeet Parhi <bishwajeet...@gmail.com> wrote:
Hey, Thanks for the follow-up . I need some help regarding setting up repo in my machine . As given in the readme files , one can either use bazel or cmake to build cctz library. I tried to install bazel but I couldn't in my device. so I used Cmake instead.

It would be nice if Bazel worked too.  Do you have more details on the problem?

Alternatively, if there is something more idiomatic on Windows than Bazel or CMake, we would be interested in help on that front.
 
Now while running the commands , I received some following error related to google-test ( I have attached the following log files in this thread).

In the "CMakeError.log" file I see ...
Determining if the include file pthread.h exists
and then ...
'pthread.h': No such file or directory
so it would seem to be working as expected if you indeed don't have pthread support.

I don't see anything CCTZ related in the "CMakeOutput.log" file, so it is difficult for me to come to any conclusions.

I do see ...
'pwsh.exe' is not recognized as an internal or external command
which seems to imply you need the PowerShell for some reason.

Overall it would be nice if CCTZ was easier to build/use on Windows.  For what it's worth, we do run pre/post-merge builds on Windows that appear to do something like ...
bazel-1.2.1-windows-x86_64.exe test --test_env="TZDIR=%CD%\testdata\zoneinfo" :all \
    --test_output=errors --test_tag_filters=-benchmark --verbose_failures=true

Being able to run the unit tests seems like a good goal.

Also , I went through the codebase and tried to understand what is being done actually. I have some doubts, Why this library doesn't work without zoneinfo files in the windows platform??

The default implementation of the cctz::TimeZoneIf interface, cctz::TimeZoneInfo, uses the data from the zoneinfo files to be able to map between civil and absolute times within a timezone.  Without that data, it can't do that.

Perhaps those files are available somewhere in a Windows distribution.  I don't know, but if so we could teach cctz::TimeZoneInfo about that.  Otherwise, the idea is to use whatever timezone data that does exist in Windows to create a new cctz::TimeZoneIf implementation.  For example, can https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ be used to do those mappings?

Bishwajeet Parhi

unread,
May 27, 2021, 1:40:32 AM5/27/21
to cctz
Hey, 
I tried to install Bazel once again (different method using chocolatey ) and it was a success . I ran the following command " bazel test :all " this the output--
error output.png
These Tests failed cause I don't have zoneinfo files right??


The default implementation of the cctz::TimeZoneIf interface, cctz::TimeZoneInfo, uses the data from the zoneinfo files to be able to map between civil and absolute times within a timezone.  Without that data, it can't do that.

Perhaps those files are available somewhere in a Windows distribution.  I don't know, but if so we could teach cctz::TimeZoneInfo about that.  Otherwise, the idea is to use whatever timezone data that does exist in Windows to create a new cctz::TimeZoneIf implementation.  For example, can https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ be used to do those mappings?

Whatever seems the best approach , I will do my best to contribute in it. 
 

Bradley White

unread,
May 27, 2021, 2:57:59 AM5/27/21
to Bishwajeet Parhi, cctz
On Thu, May 27, 2021 at 1:40 AM Bishwajeet Parhi <bishwajeet...@gmail.com> wrote:
I tried to install Bazel once again (different method using chocolatey ) and it was a success .

Excellent.
 
I ran the following command " bazel test :all " this the output--
error output.png
These Tests failed cause I don't have zoneinfo files right??

It is hard to tell without looking at the log files (or adding the --test_output=errors flag so the failures are printed).

Alternatively, given that we include the zoneinfo files in the repo, you could add the --test_env="TZDIR=%CD%\testdata\zoneinfo" flag and see if things then pass.
 
The default implementation of the cctz::TimeZoneIf interface, cctz::TimeZoneInfo, uses the data from the zoneinfo files to be able to map between civil and absolute times within a timezone.  Without that data, it can't do that.

Perhaps those files are available somewhere in a Windows distribution.  I don't know, but if so we could teach cctz::TimeZoneInfo about that.  Otherwise, the idea is to use whatever timezone data that does exist in Windows to create a new cctz::TimeZoneIf implementation.  For example, can https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ be used to do those mappings?

Whatever seems the best approach , I will do my best to contribute in it.

I took a quick look at the timezoneapi.h functions, but couldn't quite tell whether they were up to the task.

Bishwajeet Parhi

unread,
May 27, 2021, 3:15:24 AM5/27/21
to cctz


It is hard to tell without looking at the log files (or adding the --test_output=errors flag so the failures are printed).
I am attaching  these log files to see if that can help you related to this context 

Alternatively, given that we include the zoneinfo files in the repo, you could add the --test_env="TZDIR=%CD%\testdata\zoneinfo" flag and see if things then pass.
By Adding this , the  build was successful and those error were removed 🎉
 
I took a quick look at the timezoneapi.h functions, but couldn't quite tell whether they were up to the task.
Do you want me to look someplace related to it?  Which place I could get the related information??
time_zone_format_error.log
time_zone_lookup_test_erro.log

Bradley White

unread,
May 27, 2021, 12:50:49 PM5/27/21
to Bishwajeet Parhi, cctz
On Thu, May 27, 2021 at 3:15 AM Bishwajeet Parhi <bishwajeet...@gmail.com> wrote:
It is hard to tell without looking at the log files (or adding the --test_output=errors flag so the failures are printed).
I am attaching  these log files to see if that can help you related to this context 

Alternatively, given that we include the zoneinfo files in the repo, you could add the --test_env="TZDIR=%CD%\testdata\zoneinfo" flag and see if things then pass.
By Adding this , the  build was successful and those error were removed 🎉

If that worked (and I'm not at all surprised that it is required), it isn't even worth looking at the logs.

I took a quick look at the timezoneapi.h functions, but couldn't quite tell whether they were up to the task.
Do you want me to look someplace related to it?  Which place I could get the related information??

I don't know the answers to those questions.  Figuring out how to do general absolute-time <=> civil-time mappings within a named (IANA) timezone using Windows APIs is the crux of the issue.

Bishwajeet Parhi

unread,
May 29, 2021, 1:42:20 PM5/29/21
to cctz
Is there any header file related to timezoneapi.h you might know ??  Also I wanted to ask what exactly these zoneinfo files contain. I tried to take quick peek and found various folders of different countries that contains various files. but when I tried to open I really quite figure out the extension of file so it gave garbage stuffs. Just wanted to know what these files exactly contains

Bradley White

unread,
May 29, 2021, 3:22:38 PM5/29/21
to Bishwajeet Parhi, cctz
On Sat, May 29, 2021 at 1:42 PM Bishwajeet Parhi <bishwajeet...@gmail.com> wrote:
Is there any header file related to timezoneapi.h you might know ??

I'm afraid I don't know anything about the Windows APIs.  Figuring out how to do general absolute-time <=> civil-time mappings within a named (IANA) timezone using Windows APIs is the crux of the issue.  I'm only assuming that Windows must have some way to do that.
 
Also I wanted to ask what exactly these zoneinfo files contain. I tried to take quick peek and found various folders of different countries that contains various files. but when I tried to open I really quite figure out the extension of file so it gave garbage stuffs. Just wanted to know what these files exactly contains

They are binary "TZif" files containing the history (and predicted future) of UTC offsets within the named region (aka timezone).  RFC8536 describes their structure.  They are compiled using tools and source files from the TZ project.  The cctz::TimeZoneInfo implementation of the cctz::TimeZoneIf interface uses the offsets in the "TZIf" files to do its job.
Reply all
Reply to author
Forward
0 new messages