Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
please: add constants, fix km/h (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuralSpaz authored and maruel committed Nov 3, 2018
1 parent b6f010d commit e19f9a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conn/physic/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func ExampleSpeed() {
// Output:
// 10mm/s
// 299.792Mm/s
// 3.600m/s
// 277.778mm/s
// 447.040mm/s
// 304.800mm/s
}
Expand Down
16 changes: 15 additions & 1 deletion conn/physic/units.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const (
Metre Distance = 1000 * MilliMetre
KiloMetre Distance = 1000 * Metre
MegaMetre Distance = 1000 * KiloMetre
GigaMetre Distance = 1000 * MegaMetre

// Conversion between Metre and imperial units.
Thou Distance = 25400 * NanoMetre
Expand Down Expand Up @@ -112,6 +113,9 @@ const (
MicroAmpere ElectricCurrent = 1000 * NanoAmpere
MilliAmpere ElectricCurrent = 1000 * MicroAmpere
Ampere ElectricCurrent = 1000 * MilliAmpere
KiloAmpere ElectricCurrent = 1000 * Ampere
MegaAmpere ElectricCurrent = 1000 * KiloAmpere
GigaAmpere ElectricCurrent = 1000 * MegaAmpere
)

// ElectricPotential is a measurement of electric potential stored as an int64
Expand All @@ -132,6 +136,8 @@ const (
MilliVolt ElectricPotential = 1000 * MicroVolt
Volt ElectricPotential = 1000 * MilliVolt
KiloVolt ElectricPotential = 1000 * Volt
MegaVolt ElectricPotential = 1000 * KiloVolt
GigaVolt ElectricPotential = 1000 * MegaVolt
)

// ElectricResistance is a measurement of the difficulty to pass an electric
Expand All @@ -153,6 +159,7 @@ const (
Ohm ElectricResistance = 1000 * MilliOhm
KiloOhm ElectricResistance = 1000 * Ohm
MegaOhm ElectricResistance = 1000 * KiloOhm
GigaOhm ElectricResistance = 1000 * MegaOhm
)

// Force is a measurement of interaction that will change the motion of an
Expand All @@ -178,6 +185,7 @@ const (
Newton Force = 1000 * MilliNewton
KiloNewton Force = 1000 * Newton
MegaNewton Force = 1000 * KiloNewton
GigaNewton Force = 1000 * MegaNewton

EarthGravity Force = 9806650 * MicroNewton

Expand Down Expand Up @@ -218,6 +226,7 @@ const (
KiloHertz Frequency = 1000 * Hertz
MegaHertz Frequency = 1000 * KiloHertz
GigaHertz Frequency = 1000 * MegaHertz
TeraHertz Frequency = 1000 * GigaHertz
)

// Mass is a measurement of mass stored as an int64 nano gram.
Expand All @@ -239,6 +248,7 @@ const (
Gram Mass = 1000 * MilliGram
KiloGram Mass = 1000 * Gram
MegaGram Mass = 1000 * KiloGram
GigaGram Mass = 1000 * MegaGram
Tonne Mass = MegaGram

// Conversion between Gram and imperial units.
Expand Down Expand Up @@ -319,10 +329,11 @@ const (
MetrePerSecond Speed = 1000 * MilliMetrePerSecond
KiloMetrePerSecond Speed = 1000 * MetrePerSecond
MegaMetrePerSecond Speed = 1000 * KiloMetrePerSecond
GigaMetrePerSecond Speed = 1000 * MegaMetrePerSecond

LightSpeed Speed = 299792458 * MetrePerSecond

KilometrePerHour Speed = 3600 * MilliMetrePerSecond
KilometrePerHour Speed = 277777778 * NanoMetrePerSecond
MilePerHour Speed = 447040 * MicroMetrePerSecond
FootPerSecond Speed = 304800 * MicroMetrePerSecond
)
Expand All @@ -344,6 +355,9 @@ const (
MicroKelvin Temperature = 1000 * NanoKelvin
MilliKelvin Temperature = 1000 * MicroKelvin
Kelvin Temperature = 1000 * MilliKelvin
KiloKelvin Temperature = 1000 * Kelvin
MegaKelvin Temperature = 1000 * KiloKelvin
GigaKelvin Temperature = 1000 * MegaKelvin

// Conversion between Kelvin and Celsius.
ZeroCelsius Temperature = 273150 * MilliKelvin
Expand Down

1 comment on commit e19f9a0

@maruel
Copy link
Contributor

@maruel maruel commented on e19f9a0 Nov 4, 2018

Choose a reason for hiding this comment

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

Ahah, that was supposed to be physic: , not please:

Please sign in to comment.