Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 8ddefd6

Browse files
committed
C API: Implement MEOS_TFloatInst_value and MEOS_TFloatInst_timestamp
1 parent 3fbbeed commit 8ddefd6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

capi/include/meos/meos_c.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ MEOS_TFloatInst *MEOS_newTFloatInst(char *serialized);
5353
// Constructor with a value and timestamp
5454
MEOS_TFloatInst *MEOS_newTFloatInst_VT(float value, time_t timestamp);
5555

56+
float MEOS_TFloatInst_value(MEOS_TFloatInst *tfloatinst);
57+
time_t MEOS_TFloatInst_timestamp(MEOS_TFloatInst *tfloatinst);
5658
char *MEOS_TFloatInst_str(MEOS_TFloatInst *tfloatinst);
5759

5860
void MEOS_deleteTFloatInst(MEOS_TFloatInst *tfloatinst);

capi/source/meos_c.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ MEOS_TFloatInst *MEOS_newTFloatInst_VT(float value, time_t timestamp) {
8585
new meos::TFloatInst(value, std::chrono::system_clock::from_time_t(timestamp)));
8686
}
8787

88+
float MEOS_TFloatInst_value(MEOS_TFloatInst *tfloatinst) {
89+
auto t = reinterpret_cast<meos::TFloatInst *>(tfloatinst);
90+
return t->getValue();
91+
}
92+
93+
time_t MEOS_TFloatInst_timestamp(MEOS_TFloatInst *tfloatinst) {
94+
auto t = reinterpret_cast<meos::TFloatInst *>(tfloatinst);
95+
return std::chrono::system_clock::to_time_t(t->getTimestamp());
96+
}
97+
8898
// Remember to free the result!
8999
char *MEOS_TFloatInst_str(MEOS_TFloatInst *tfloatinst) {
90100
auto t = reinterpret_cast<meos::TFloatInst *>(tfloatinst);

0 commit comments

Comments
 (0)