From b0e405308727124995d7f9af3d5dc71aa3a59cc5 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 5 Dec 2022 21:56:04 -0800 Subject: [PATCH] [ntcore] Use int for options instead of double Periodic time is stored in milliseconds. --- .../generate/java/NetworkTablesJNI.java.jinja | 14 +++++----- .../wpi/first/networktables/PubSubOption.java | 18 ++++++------- ntcore/src/main/native/cpp/PubSubOptions.cpp | 2 +- ntcore/src/main/native/cpp/PubSubOptions.h | 4 ++- .../main/native/cpp/jni/NetworkTablesJNI.cpp | 26 +++++++++---------- ntcore/src/main/native/cpp/net/ClientImpl.cpp | 2 +- ntcore/src/main/native/cpp/net/ServerImpl.cpp | 11 ++++---- .../src/main/native/cpp/net/WireDecoder.cpp | 4 ++- .../src/main/native/cpp/net/WireEncoder.cpp | 4 +-- .../src/main/native/cpp/net3/ClientImpl3.cpp | 2 +- ntcore/src/main/native/include/ntcore_c.h | 7 ++--- ntcore/src/main/native/include/ntcore_cpp.h | 23 ++++++++-------- .../src/test/native/cpp/LocalStorageTest.cpp | 2 +- .../test/native/cpp/PubSubOptionsMatcher.cpp | 2 +- ntcore/src/test/native/cpp/TestPrinters.cpp | 2 +- .../test/native/cpp/net/WireEncoderTest.cpp | 4 +-- 16 files changed, 67 insertions(+), 60 deletions(-) diff --git a/ntcore/src/generate/java/NetworkTablesJNI.java.jinja b/ntcore/src/generate/java/NetworkTablesJNI.java.jinja index 68dc37e2e1..269c20a098 100644 --- a/ntcore/src/generate/java/NetworkTablesJNI.java.jinja +++ b/ntcore/src/generate/java/NetworkTablesJNI.java.jinja @@ -65,8 +65,8 @@ public final class NetworkTablesJNI { return rv; } - private static double[] pubSubOptionValues(PubSubOption... options) { - double[] rv = new double[options.length]; + private static int[] pubSubOptionValues(PubSubOption... options) { + int[] rv = new int[options.length]; for (int i = 0; i < options.length; i++) { rv[i] = options[i].m_value; } @@ -84,7 +84,7 @@ public final class NetworkTablesJNI { public static native int getEntry(int inst, String key); private static native int getEntry( - int topic, int type, String typeStr, int[] optionTypes, double[] optionValues); + int topic, int type, String typeStr, int[] optionTypes, int[] optionValues); public static int getEntry(int topic, int type, String typeStr, PubSubOption... options) { return getEntry(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options)); @@ -137,7 +137,7 @@ public final class NetworkTablesJNI { public static native void setTopicProperties(int topic, String properties); private static native int subscribe( - int topic, int type, String typeStr, int[] optionTypes, double[] optionValues); + int topic, int type, String typeStr, int[] optionTypes, int[] optionValues); public static int subscribe(int topic, int type, String typeStr, PubSubOption... options) { return subscribe(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options)); @@ -146,14 +146,14 @@ public final class NetworkTablesJNI { public static native void unsubscribe(int sub); private static native int publish( - int topic, int type, String typeStr, int[] optionTypes, double[] optionValues); + int topic, int type, String typeStr, int[] optionTypes, int[] optionValues); public static int publish(int topic, int type, String typeStr, PubSubOption... options) { return publish(topic, type, typeStr, pubSubOptionTypes(options), pubSubOptionValues(options)); } private static native int publishEx( - int topic, int type, String typeStr, String properties, int[] optionTypes, double[] optionValues); + int topic, int type, String typeStr, String properties, int[] optionTypes, int[] optionValues); public static int publishEx(int topic, int type, String typeStr, String properties, PubSubOption... options) { return publishEx(topic, type, typeStr, properties, pubSubOptionTypes(options), pubSubOptionValues(options)); @@ -168,7 +168,7 @@ public final class NetworkTablesJNI { public static native int getTopicFromHandle(int pubsubentry); private static native int subscribeMultiple( - int inst, String[] prefixes, int[] optionTypes, double[] optionValues); + int inst, String[] prefixes, int[] optionTypes, int[] optionValues); public static int subscribeMultiple(int inst, String[] prefixes, PubSubOption... options) { return subscribeMultiple( diff --git a/ntcore/src/main/java/edu/wpi/first/networktables/PubSubOption.java b/ntcore/src/main/java/edu/wpi/first/networktables/PubSubOption.java index 7cf072474c..371f564a83 100644 --- a/ntcore/src/main/java/edu/wpi/first/networktables/PubSubOption.java +++ b/ntcore/src/main/java/edu/wpi/first/networktables/PubSubOption.java @@ -13,7 +13,7 @@ public class PubSubOption { private static final int kKeepDuplicates = 5; private static final int kLocalRemote = 6; - PubSubOption(int type, double value) { + PubSubOption(int type, int value) { m_type = type; m_value = value; } @@ -28,7 +28,7 @@ public class PubSubOption { * @return option */ public static PubSubOption periodic(double period) { - return new PubSubOption(kPeriodic, period); + return new PubSubOption(kPeriodic, (int) (period * 1000)); } /** @@ -39,7 +39,7 @@ public class PubSubOption { * @return option */ public static PubSubOption sendAll(boolean enabled) { - return new PubSubOption(kSendAll, enabled ? 1.0 : 0.0); + return new PubSubOption(kSendAll, enabled ? 1 : 0); } /** @@ -49,7 +49,7 @@ public class PubSubOption { * @return option */ public static PubSubOption topicsOnly(boolean enabled) { - return new PubSubOption(kTopicsOnly, enabled ? 1.0 : 0.0); + return new PubSubOption(kTopicsOnly, enabled ? 1 : 0); } /** @@ -60,7 +60,7 @@ public class PubSubOption { * @return option */ public static PubSubOption keepDuplicates(boolean enabled) { - return new PubSubOption(kKeepDuplicates, enabled ? 1.0 : 0.0); + return new PubSubOption(kKeepDuplicates, enabled ? 1 : 0); } /** @@ -82,7 +82,7 @@ public class PubSubOption { * @return option */ public static PubSubOption localOnly() { - return new PubSubOption(kLocalRemote, 1.0); + return new PubSubOption(kLocalRemote, 1); } /** @@ -92,7 +92,7 @@ public class PubSubOption { * @return option */ public static PubSubOption remoteOnly() { - return new PubSubOption(kLocalRemote, 2.0); + return new PubSubOption(kLocalRemote, 2); } /** @@ -102,9 +102,9 @@ public class PubSubOption { * @return option */ public static PubSubOption allUpdates() { - return new PubSubOption(kLocalRemote, 0.0); + return new PubSubOption(kLocalRemote, 0); } final int m_type; - final double m_value; + final int m_value; } diff --git a/ntcore/src/main/native/cpp/PubSubOptions.cpp b/ntcore/src/main/native/cpp/PubSubOptions.cpp index 27954f9228..538bc501b3 100644 --- a/ntcore/src/main/native/cpp/PubSubOptions.cpp +++ b/ntcore/src/main/native/cpp/PubSubOptions.cpp @@ -12,7 +12,7 @@ nt::PubSubOptions::PubSubOptions(std::span options) { for (auto&& option : options) { switch (option.type) { case NT_PUBSUB_PERIODIC: - periodic = option.value; + periodicMs = option.value; break; case NT_PUBSUB_SENDALL: sendAll = option.value != 0; diff --git a/ntcore/src/main/native/cpp/PubSubOptions.h b/ntcore/src/main/native/cpp/PubSubOptions.h index 40e3194831..ba57e0e11a 100644 --- a/ntcore/src/main/native/cpp/PubSubOptions.h +++ b/ntcore/src/main/native/cpp/PubSubOptions.h @@ -16,7 +16,9 @@ class PubSubOptions { PubSubOptions() = default; explicit PubSubOptions(std::span options); - double periodic = 0.1; + static constexpr unsigned int kDefaultPeriodicMs = 100; + + unsigned int periodicMs = kDefaultPeriodicMs; size_t pollStorageSize = 1; bool sendAll = false; bool topicsOnly = false; diff --git a/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp b/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp index 66f7dbb953..f072bcd706 100644 --- a/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp +++ b/ntcore/src/main/native/cpp/jni/NetworkTablesJNI.cpp @@ -118,10 +118,10 @@ JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) { // static std::span FromJavaPubSubOptions( - JNIEnv* env, jintArray optionTypes, jdoubleArray optionValues, + JNIEnv* env, jintArray optionTypes, jintArray optionValues, wpi::SmallVectorImpl& arr) { JIntArrayRef types{env, optionTypes}; - JDoubleArrayRef values{env, optionValues}; + JIntArrayRef values{env, optionValues}; if (types.size() != values.size()) { return {}; } @@ -720,12 +720,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_setTopicProperties /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: subscribe - * Signature: (IILjava/lang/String;[I[D)I + * Signature: (IILjava/lang/String;[I[I)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_subscribe (JNIEnv* env, jclass, jint topic, jint type, jstring typeStr, - jintArray optionTypes, jdoubleArray optionValues) + jintArray optionTypes, jintArray optionValues) { wpi::SmallVector options; return nt::Subscribe( @@ -748,12 +748,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_unsubscribe /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: publish - * Signature: (IILjava/lang/String;[I[D)I + * Signature: (IILjava/lang/String;[I[I)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_publish (JNIEnv* env, jclass, jint topic, jint type, jstring typeStr, - jintArray optionTypes, jdoubleArray optionValues) + jintArray optionTypes, jintArray optionValues) { wpi::SmallVector options; return nt::Publish( @@ -764,12 +764,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_publish /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: publishEx - * Signature: (IILjava/lang/String;Ljava/lang/String;[I[D)I + * Signature: (IILjava/lang/String;Ljava/lang/String;[I[I)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_publishEx (JNIEnv* env, jclass, jint topic, jint type, jstring typeStr, - jstring properties, jintArray optionTypes, jdoubleArray optionValues) + jstring properties, jintArray optionTypes, jintArray optionValues) { wpi::json j; try { @@ -804,12 +804,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_unpublish /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: getEntry - * Signature: (IILjava/lang/String;[I[D)I + * Signature: (IILjava/lang/String;[I[I)I */ JNIEXPORT jint JNICALL -Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry__IILjava_lang_String_2_3I_3D +Java_edu_wpi_first_networktables_NetworkTablesJNI_getEntry__IILjava_lang_String_2_3I_3I (JNIEnv* env, jclass, jint topic, jint type, jstring typeStr, - jintArray optionTypes, jdoubleArray optionValues) + jintArray optionTypes, jintArray optionValues) { wpi::SmallVector options; return nt::GetEntry( @@ -856,12 +856,12 @@ Java_edu_wpi_first_networktables_NetworkTablesJNI_getTopicFromHandle /* * Class: edu_wpi_first_networktables_NetworkTablesJNI * Method: subscribeMultiple - * Signature: (I[Ljava/lang/Object;[I[D)I + * Signature: (I[Ljava/lang/Object;[I[I)I */ JNIEXPORT jint JNICALL Java_edu_wpi_first_networktables_NetworkTablesJNI_subscribeMultiple (JNIEnv* env, jclass, jint inst, jobjectArray prefixes, jintArray optionTypes, - jdoubleArray optionValues) + jintArray optionValues) { if (!prefixes) { nullPointerEx.Throw(env, "prefixes cannot be null"); diff --git a/ntcore/src/main/native/cpp/net/ClientImpl.cpp b/ntcore/src/main/native/cpp/net/ClientImpl.cpp index baf0bc05d8..6a9a68fdd0 100644 --- a/ntcore/src/main/native/cpp/net/ClientImpl.cpp +++ b/ntcore/src/main/native/cpp/net/ClientImpl.cpp @@ -293,7 +293,7 @@ void CImpl::Publish(NT_Publisher pubHandle, NT_Topic topicHandle, } publisher->handle = pubHandle; publisher->options = options; - publisher->periodMs = std::lround(options.periodic * 100) * 10; + publisher->periodMs = std::lround(options.periodicMs / 10.0) * 10; if (publisher->periodMs < kMinPeriodMs) { publisher->periodMs = kMinPeriodMs; } diff --git a/ntcore/src/main/native/cpp/net/ServerImpl.cpp b/ntcore/src/main/native/cpp/net/ServerImpl.cpp index 9a1ccfa272..98ebdc7322 100644 --- a/ntcore/src/main/native/cpp/net/ServerImpl.cpp +++ b/ntcore/src/main/native/cpp/net/ServerImpl.cpp @@ -367,7 +367,7 @@ struct SubscriberData { topicNames{topicNames.begin(), topicNames.end()}, subuid{subuid}, options{options}, - periodMs(std::lround(options.periodic * 100) * 10) { + periodMs(std::lround(options.periodicMs / 10.0) * 10) { if (periodMs < kMinPeriodMs) { periodMs = kMinPeriodMs; } @@ -377,7 +377,7 @@ struct SubscriberData { const PubSubOptions& options_) { topicNames = {topicNames_.begin(), topicNames_.end()}; options = options_; - periodMs = std::lround(options_.periodic * 100) * 10; + periodMs = std::lround(options_.periodicMs / 10.0) * 10; if (periodMs < kMinPeriodMs) { periodMs = kMinPeriodMs; } @@ -465,7 +465,8 @@ struct Writer : public mpack_writer_t { static void WriteOptions(mpack_writer_t& w, const PubSubOptions& options) { int size = (options.sendAll ? 1 : 0) + (options.topicsOnly ? 1 : 0) + - (options.periodic != 0.1 ? 1 : 0) + (options.prefixMatch ? 1 : 0); + (options.periodicMs != PubSubOptions::kDefaultPeriodicMs ? 1 : 0) + + (options.prefixMatch ? 1 : 0); mpack_start_map(&w, size); if (options.sendAll) { mpack_write_str(&w, "all"); @@ -475,9 +476,9 @@ static void WriteOptions(mpack_writer_t& w, const PubSubOptions& options) { mpack_write_str(&w, "topicsonly"); mpack_write_bool(&w, true); } - if (options.periodic != 0.1) { + if (options.periodicMs != PubSubOptions::kDefaultPeriodicMs) { mpack_write_str(&w, "periodic"); - mpack_write_float(&w, options.periodic); + mpack_write_float(&w, options.periodicMs / 1000.0); } if (options.prefixMatch) { mpack_write_str(&w, "prefix"); diff --git a/ntcore/src/main/native/cpp/net/WireDecoder.cpp b/ntcore/src/main/native/cpp/net/WireDecoder.cpp index 2de6b99d3a..785e3ebf8e 100644 --- a/ntcore/src/main/native/cpp/net/WireDecoder.cpp +++ b/ntcore/src/main/native/cpp/net/WireDecoder.cpp @@ -238,10 +238,12 @@ static void WireDecodeTextImpl(std::string_view in, T& out, // periodic auto periodicIt = joptions->find("periodic"); if (periodicIt != joptions->end()) { - if (!GetNumber(periodicIt->second, &options.periodic)) { + double val; + if (!GetNumber(periodicIt->second, &val)) { error = "periodic value must be a number"; goto err; } + options.periodicMs = val * 1000; } // send all changes diff --git a/ntcore/src/main/native/cpp/net/WireEncoder.cpp b/ntcore/src/main/native/cpp/net/WireEncoder.cpp index 2ef6bdf75d..0482b43d8a 100644 --- a/ntcore/src/main/native/cpp/net/WireEncoder.cpp +++ b/ntcore/src/main/native/cpp/net/WireEncoder.cpp @@ -99,12 +99,12 @@ static void WireEncodeSubscribeImpl(wpi::raw_ostream& os, int64_t subuid, os << "\"prefix\":true"; first = false; } - if (options.periodic != 0.1) { + if (options.periodicMs != PubSubOptions::kDefaultPeriodicMs) { if (!first) { os << ','; } os << "\"periodic\":"; - s.dump_float(options.periodic); + s.dump_float(options.periodicMs / 1000.0); } os << "},\"topics\":"; EncodePrefixes(os, topicNames, s); diff --git a/ntcore/src/main/native/cpp/net3/ClientImpl3.cpp b/ntcore/src/main/native/cpp/net3/ClientImpl3.cpp index 513938c3cf..579f94daec 100644 --- a/ntcore/src/main/native/cpp/net3/ClientImpl3.cpp +++ b/ntcore/src/main/native/cpp/net3/ClientImpl3.cpp @@ -330,7 +330,7 @@ void CImpl::Publish(NT_Publisher pubHandle, NT_Topic topicHandle, } publisher->handle = pubHandle; publisher->options = options; - publisher->periodMs = std::lround(options.periodic * 100) * 10; + publisher->periodMs = std::lround(options.periodicMs / 10.0) * 10; if (publisher->periodMs < 10) { publisher->periodMs = 10; } diff --git a/ntcore/src/main/native/include/ntcore_c.h b/ntcore/src/main/native/include/ntcore_c.h index e9b8255d7e..e773abd2e1 100644 --- a/ntcore/src/main/native/include/ntcore_c.h +++ b/ntcore/src/main/native/include/ntcore_c.h @@ -288,10 +288,11 @@ struct NT_PubSubOption { /** * Option value. 1 (true) or 0 (false) for immediate and logging options, - * time between updates, in seconds, for periodic option. For local/remote - * option, 1=local only, 2=remote only, 0 or 3=both local and remote. + * time between updates, in milliseconds, for periodic option. For + * local/remote option, 1=local only, 2=remote only, 0 or 3=both local and + * remote. */ - double value; + unsigned int value; }; /** diff --git a/ntcore/src/main/native/include/ntcore_cpp.h b/ntcore/src/main/native/include/ntcore_cpp.h index c5b01698a7..bcdf168135 100644 --- a/ntcore/src/main/native/include/ntcore_cpp.h +++ b/ntcore/src/main/native/include/ntcore_cpp.h @@ -262,7 +262,7 @@ class Event { /** NetworkTables publish/subscribe option. */ class PubSubOption { public: - constexpr PubSubOption(NT_PubSubOptionType type, double value) + constexpr PubSubOption(NT_PubSubOptionType type, unsigned int value) : type{type}, value{value} {} /** @@ -276,7 +276,8 @@ class PubSubOption { * @return option */ static constexpr PubSubOption Periodic(double time) { - return PubSubOption{NT_PUBSUB_PERIODIC, time}; + return PubSubOption{NT_PUBSUB_PERIODIC, + static_cast(time * 1000)}; } /** @@ -287,7 +288,7 @@ class PubSubOption { * @return option */ static constexpr PubSubOption SendAll(bool enabled) { - return PubSubOption{NT_PUBSUB_SENDALL, enabled ? 1.0 : 0.0}; + return PubSubOption{NT_PUBSUB_SENDALL, enabled ? 1u : 0u}; } /** @@ -298,7 +299,7 @@ class PubSubOption { * @return option */ static constexpr PubSubOption TopicsOnly(bool enabled) { - return PubSubOption{NT_PUBSUB_TOPICSONLY, enabled ? 1.0 : 0.0}; + return PubSubOption{NT_PUBSUB_TOPICSONLY, enabled ? 1u : 0u}; } /** @@ -309,7 +310,7 @@ class PubSubOption { * @return option */ static constexpr PubSubOption KeepDuplicates(bool enabled) { - return PubSubOption{NT_PUBSUB_KEEPDUPLICATES, enabled ? 1.0 : 0.0}; + return PubSubOption{NT_PUBSUB_KEEPDUPLICATES, enabled ? 1u : 0u}; } /** @@ -320,8 +321,8 @@ class PubSubOption { * @param depth number of entries to save for polling. * @return option */ - static constexpr PubSubOption PollStorage(int depth) { - return PubSubOption{NT_PUBSUB_POLLSTORAGE, static_cast(depth)}; + static constexpr PubSubOption PollStorage(unsigned int depth) { + return PubSubOption{NT_PUBSUB_POLLSTORAGE, depth}; } /** @@ -332,7 +333,7 @@ class PubSubOption { * @return option */ static constexpr PubSubOption LocalOnly() { - return PubSubOption{NT_PUBSUB_LOCALREMOTE, 1.0}; + return PubSubOption{NT_PUBSUB_LOCALREMOTE, 1u}; } /** @@ -343,7 +344,7 @@ class PubSubOption { * @return option */ static constexpr PubSubOption RemoteOnly() { - return PubSubOption{NT_PUBSUB_LOCALREMOTE, 2.0}; + return PubSubOption{NT_PUBSUB_LOCALREMOTE, 2u}; } /** @@ -354,11 +355,11 @@ class PubSubOption { * @return option */ static constexpr PubSubOption AllUpdates() { - return PubSubOption{NT_PUBSUB_LOCALREMOTE, 0.0}; + return PubSubOption{NT_PUBSUB_LOCALREMOTE, 0u}; } NT_PubSubOptionType type; - double value; + unsigned int value; }; /** diff --git a/ntcore/src/test/native/cpp/LocalStorageTest.cpp b/ntcore/src/test/native/cpp/LocalStorageTest.cpp index ebe098fe66..cc30b0b69d 100644 --- a/ntcore/src/test/native/cpp/LocalStorageTest.cpp +++ b/ntcore/src/test/native/cpp/LocalStorageTest.cpp @@ -27,7 +27,7 @@ namespace nt { ::testing::Matcher IsPubSubOptions( const PubSubOptions& good) { - return AllOf(Field("periodic", &PubSubOptions::periodic, good.periodic), + return AllOf(Field("periodic", &PubSubOptions::periodicMs, good.periodicMs), Field("pollStorageSize", &PubSubOptions::pollStorageSize, good.pollStorageSize), Field("logging", &PubSubOptions::sendAll, good.sendAll), diff --git a/ntcore/src/test/native/cpp/PubSubOptionsMatcher.cpp b/ntcore/src/test/native/cpp/PubSubOptionsMatcher.cpp index 5c3d067c47..e9719f97dd 100644 --- a/ntcore/src/test/native/cpp/PubSubOptionsMatcher.cpp +++ b/ntcore/src/test/native/cpp/PubSubOptionsMatcher.cpp @@ -11,7 +11,7 @@ namespace nt { bool PubSubOptionsMatcher::MatchAndExplain( const PubSubOptions& val, ::testing::MatchResultListener* listener) const { bool match = true; - if (val.periodic != good.periodic) { + if (val.periodicMs != good.periodicMs) { *listener << "periodic mismatch "; match = false; } diff --git a/ntcore/src/test/native/cpp/TestPrinters.cpp b/ntcore/src/test/native/cpp/TestPrinters.cpp index 2d9eb91664..36fdb9759c 100644 --- a/ntcore/src/test/native/cpp/TestPrinters.cpp +++ b/ntcore/src/test/native/cpp/TestPrinters.cpp @@ -161,7 +161,7 @@ void PrintTo(const Value& value, std::ostream* os) { } void PrintTo(const PubSubOptions& options, std::ostream* os) { - *os << "PubSubOptions{periodic=" << options.periodic + *os << "PubSubOptions{periodicMs=" << options.periodicMs << ", pollStorageSize=" << options.pollStorageSize << ", logging=" << options.sendAll << ", keepDuplicates=" << options.keepDuplicates << '}'; diff --git a/ntcore/src/test/native/cpp/net/WireEncoderTest.cpp b/ntcore/src/test/native/cpp/net/WireEncoderTest.cpp index 6b849a0ad2..49379c3428 100644 --- a/ntcore/src/test/native/cpp/net/WireEncoderTest.cpp +++ b/ntcore/src/test/native/cpp/net/WireEncoderTest.cpp @@ -86,7 +86,7 @@ TEST_F(WireEncoderTextTest, SubscribeSendAll) { TEST_F(WireEncoderTextTest, SubscribePeriodic) { PubSubOptions options; - options.periodic = 0.5; + options.periodicMs = 500u; net::WireEncodeSubscribe(os, 5, std::span{{"a", "b"}}, options); ASSERT_EQ(os.str(), @@ -98,7 +98,7 @@ TEST_F(WireEncoderTextTest, SubscribePeriodic) { TEST_F(WireEncoderTextTest, SubscribeAllOptions) { PubSubOptions options; options.sendAll = true; - options.periodic = 0.5; + options.periodicMs = 500u; net::WireEncodeSubscribe(os, 5, std::span{{"a", "b"}}, options); ASSERT_EQ(os.str(),