Skip to content

Commit

Permalink
Update to 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
da-luce committed Jan 22, 2025
2 parents 9334da1 + 63095be commit 83d8143
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('astroterm', 'c',
version: '1.0.5',
version: '1.0.6',
default_options : ['warning_level=3', 'buildtype=debug'],
meson_version: '>=1.4.0',
)
Expand Down
16 changes: 9 additions & 7 deletions scripts/bsc5_ascii_to_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,16 @@ def create_binary_header() -> bytes:

def create_binary_entry(entry : CatalogEntry) -> bytes:
"""Write a single catalog entry to the binary file."""

# Using '<' to force little endian byte order
binary_entry = (
struct.pack('f', entry.XNO) + # Catalog number (Real*4)
struct.pack('d', entry.SRA0) + # Right Ascension in radians (Real*8)
struct.pack('d', entry.SDEC0) + # Declination in radians (Real*8)
entry.IS.encode('ascii').ljust(2, b'\x00') + # Spectral type (Character*2)
struct.pack('h', entry.MAG) + # V Magnitude * 100 (Integer*2)
struct.pack('f', entry.XRPM) + # R.A. proper motion (Real*4)
struct.pack('f', entry.XDPM) # Dec. proper motion (Real*4)
struct.pack('<f', entry.XNO) + # Catalog number (Real*4)
struct.pack('<d', entry.SRA0) + # Right Ascension in radians (Real*8)
struct.pack('<d', entry.SDEC0) + # Declination in radians (Real*8)
entry.IS.encode('ascii').ljust(2, b'\x00') + # Spectral type (Character*2)
struct.pack('<h', entry.MAG) + # V Magnitude * 100 (Integer*2)
struct.pack('<f', entry.XRPM) + # R.A. proper motion (Real*4)
struct.pack('<f', entry.XDPM) # Dec. proper motion (Real*4)
)

assert len(binary_entry) == 32, (
Expand Down
16 changes: 8 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,14 @@ const char *get_timezone(const struct tm *local_time)
#ifdef _WIN32
// Windows-specific code
TIME_ZONE_INFORMATION tz_info;
if (GetTimeZoneInformation(&tz_info) == TIME_ZONE_ID_DAYLIGHT && local_time->tm_isdst > 0)
{
return tz_info.DaylightName; // DST time zone name
}
else
{
return tz_info.StandardName; // Standard time zone name
}
GetTimeZoneInformation(&tz_info);

static char tzbuf[8];
char sign = tz_info.Bias > 0 ? '-' : '+';
long hours = labs(tz_info.Bias) / 60;
long minutes = labs(tz_info.Bias) % 60;
snprintf(tzbuf, sizeof(tzbuf), "%c%02ld:%02ld", sign, hours, minutes);
return tzbuf;
#else
// Unix-like systems (Linux/macOS) code
extern char *tzname[2]; // tzname[0] is standard, tzname[1] is DST
Expand Down

0 comments on commit 83d8143

Please sign in to comment.