Skip to content

Commit

Permalink
add compiler args for strptime
Browse files Browse the repository at this point in the history
  • Loading branch information
da-luce committed Jan 14, 2025
1 parent a5a7ab8 commit 44c690d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/strptime.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#ifndef STRPTIME_H
#define STRPTIME_H

#ifndef HAS_STRPTIME
#include <time.h>

char *strptime(const char *s, const char *format, struct tm *tm);

#endif // HAS_STRPTIME

#endif // STRPTIME_H
3 changes: 3 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ if cc.get_id() == 'msvc'
add_project_arguments('/utf-8', language: 'c')
else
add_project_link_arguments('-no-pie', language: 'c')

# Needed to make GCC happy with `strptime`
add_project_arguments('-D_XOPEN_SOURCE', '-D_GNU_SOURCE', language : 'c')
endif

build_defines = []
Expand Down
1 change: 1 addition & 0 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "astro.h"
#include "parse_BSC5.h"
#include "strptime.h"

#include <math.h>
#include <stdio.h>
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ if not has_strptime
)
else
message('strptime is available, no need for local implementation.')
build_defines += '-DHAS_STRPTIME'
lib_strptime = []
endif

0 comments on commit 44c690d

Please sign in to comment.