Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
42d95d47
Commit
42d95d47
authored
Apr 17, 2019
by
Michael Ott
Browse files
Add unit conversions for J and Wh
parent
1c499f77
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/include/dcdb/unitconv.h
View file @
42d95d47
...
...
@@ -47,6 +47,8 @@ typedef enum {
Unit_Watt
,
Unit_Volt
,
Unit_Hertz
,
Unit_Joules
,
Unit_WattHours
,
/* Others */
Unit_Celsius
,
...
...
@@ -55,10 +57,14 @@ typedef enum {
/* 1e3 */
Unit_KiloHertz
,
Unit_KiloWatt
,
Unit_KiloJoules
,
Unit_KiloWattHours
,
/* 1e6 */
Unit_MegaHertz
,
Unit_MegaWatt
,
Unit_MegaJoules
,
Unit_MegaWattHours
,
/* 1e9 */
Unit_GigaHertz
,
...
...
lib/src/unitconv.cpp
View file @
42d95d47
...
...
@@ -113,7 +113,12 @@ ConversionTableEntry conversionTable[] = {
/* 28 */
{
Unit_Hertz
,
"Hz"
,
Unit_Hertz
,
1
,
0
},
/* 29 */
{
Unit_KiloHertz
,
"kHz"
,
Unit_Hertz
,
1000
,
0
},
/* 30 */
{
Unit_MegaHertz
,
"MHz"
,
Unit_Hertz
,
1000000
,
0
},
/* 31 */
{
Unit_GigaHertz
,
"GHz"
,
Unit_Hertz
,
1000000000
,
0
},
/* 31 */
{
Unit_Joules
,
"J"
,
Unit_Joules
,
3600
,
0
},
/* 32 */
{
Unit_KiloJoules
,
"kJ"
,
Unit_Joules
,
1000
,
0
},
/* 33 */
{
Unit_MegaJoules
,
"MJ"
,
Unit_Joules
,
1000000
,
0
},
/* 34 */
{
Unit_WattHours
,
"Wh"
,
Unit_Joules
,
3600
,
0
},
/* 35 */
{
Unit_KiloWattHours
,
"kWh"
,
Unit_WattHours
,
1000
,
0
},
/* 36 */
{
Unit_MegaWattHours
,
"MWh"
,
Unit_WattHours
,
1000000
,
0
},
};
#define ConversionTableSize ((int)(sizeof(conversionTable)/sizeof(ConversionTableEntry)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment