Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bindings/cxx/classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ shared_ptr<UserDevice> Context::create_user_device(
default_delete<UserDevice>{}};
}

shared_ptr<Packet> Context::create_header_packet(Glib::TimeVal start_time)
shared_ptr<Packet> Context::create_header_packet(Glib::DateTime start_time)
{
auto header = g_new(struct sr_datafeed_header, 1);
header->feed_version = 1;
header->starttime.tv_sec = start_time.tv_sec;
header->starttime.tv_usec = start_time.tv_usec;
header->starttime.tv_sec = start_time.get_second();
header->starttime.tv_usec = start_time.get_microsecond();
auto packet = g_new(struct sr_datafeed_packet, 1);
packet->type = SR_DF_HEADER;
packet->payload = header;
Expand Down Expand Up @@ -1154,11 +1154,11 @@ int Header::feed_version() const
return _structure->feed_version;
}

Glib::TimeVal Header::start_time() const
Glib::DateTime Header::start_time() const
{
return Glib::TimeVal(
_structure->starttime.tv_sec,
_structure->starttime.tv_usec);
Glib::DateTime dt = Glib::DateTime();
dt.add_seconds(_structure->starttime.tv_sec + (_structure->starttime.tv_usec / 1000 / 1000));
return dt;
}

Meta::Meta(const struct sr_datafeed_meta *structure) :
Expand Down
4 changes: 2 additions & 2 deletions bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class SR_API Context : public UserOwned<Context>
std::shared_ptr<UserDevice> create_user_device(
std::string vendor, std::string model, std::string version);
/** Create a header packet. */
std::shared_ptr<Packet> create_header_packet(Glib::TimeVal start_time);
std::shared_ptr<Packet> create_header_packet(Glib::DateTime start_time);
/** Create a meta packet. */
std::shared_ptr<Packet> create_meta_packet(
std::map<const ConfigKey *, Glib::VariantBase> config);
Expand Down Expand Up @@ -711,7 +711,7 @@ class SR_API Header :
/* Feed version number. */
int feed_version() const;
/* Start time of this session. */
Glib::TimeVal start_time() const;
Glib::DateTime start_time() const;
private:
explicit Header(const struct sr_datafeed_header *structure);
~Header();
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ SR_PKG_VERSION_SET([SR_PACKAGE_VERSION], [AC_PACKAGE_VERSION])
SR_LIB_VERSION_SET([SR_LIB_VERSION], [4:0:0])

AM_CONDITIONAL([WIN32], [test -z "${host_os##mingw*}" || test -z "${host_os##cygwin*}"])
AM_CONDITIONAL([MACOS], [test -z "${host_os##darwin*}"])

#############################
## Optional dependencies ##
Expand Down Expand Up @@ -371,7 +372,9 @@ AS_IF([test "x$HAVE_CXX11" != x1],
[SR_APPEND([sr_cxx_missing], [', '], ['C++11'])])

# The C++ bindings need glibmm.
SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.4 >= 2.32.0])
AM_COND_IF([MACOS],
[SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.68 >= 2.32.0])],
[SR_PKG_CHECK([glibmm], [SR_PKGLIBS_CXX], [glibmm-2.4 >= 2.32.0])])
Comment on lines -374 to +377

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS/Homebrew, glibmm is named differently.

$ pkg-config --list-all | grep glib
gio-unix-2.0                        GIO unix specific APIs - unix specific headers for glib I/O library
gio-2.0                             GIO - glib I/O library
glib-2.0                            GLib - C Utility Library
glibmm-2.68                         glibmm - C++ wrapper for GLib

AS_IF([test "x$sr_have_glibmm" != xyes],
[SR_APPEND([sr_cxx_missing], [', '], [glibmm])])

Expand Down