Skip to content

Commit

Permalink
expand tz_params_latitude() method
Browse files Browse the repository at this point in the history
tweak parameters using opt_ prefix for optional
  • Loading branch information
ikluft committed Dec 15, 2023
1 parent 54f7526 commit 2e637e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions src/cpp/libtzsolar/libtzsolar/libtzsolar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

#include "libtzsolar.hpp"
#include <cmath>

// generate a solar time zone name
// parameters:
Expand All @@ -24,16 +25,22 @@ std::string TZSolar::tz_name ( int tz_num, bool use_lon_tz, short sign ) {
return prefix + tz_numstr + suffix;
}

// get timezone parameters (name and minutes offset) - called by constructor
void TZSolar::tz_params_latitude ( short longitude, bool use_lon_tz, boost::optional<short> latitude ) {
// check latitude data and initialize special case for polar regions - internal method called by tz_params()
void TZSolar::tz_params_latitude ( short longitude, bool use_lon_tz, short latitude ) {
// special case: use East00/Lon000E (equal to UTC) within 10° latitude of poles
if ( abs( latitude ) >= limit_latitude - precision_fp ) {
// TODO
}

// TODO
}


// get timezone parameters (name and minutes offset) - called by constructor
void TZSolar::tz_params ( short longitude, bool use_lon_tz, boost::optional<short> latitude ) {
void TZSolar::tz_params ( short longitude, bool use_lon_tz, boost::optional<short> opt_latitude ) {
// if latitude is provided, use UTC within 10° latitude of poles
if ( latitude != boost::none ) {
this->tz_params_latitude( longitude, use_lon_tz, latitude );
if ( opt_latitude != boost::none ) {
this->tz_params_latitude( longitude, use_lon_tz, opt_latitude.get() );
}
// TODO
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/libtzsolar/libtzsolar/libtzsolar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class TZSolar {
static std::string tz_name ( int tz_num, bool use_lon_tz, short sign );

// get timezone parameters (name and minutes offset) - called by constructor
void tz_params_latitude ( short longitude, bool use_lon_tz, boost::optional<short> latitude );
void tz_params_latitude ( short longitude, bool use_lon_tz, short latitude );

// get timezone parameters (name and minutes offset) - called by constructor
void tz_params ( short longitude, bool use_lon_tz, boost::optional<short> latitude );
void tz_params ( short longitude, bool use_lon_tz, boost::optional<short> opt_latitude );

// TODO: more private methods

Expand Down

0 comments on commit 2e637e8

Please sign in to comment.