mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-18 22:01:42 -04:00
Generate Arduino code from C code. Patch for limited time functionality.
This commit is contained in:
@@ -20,6 +20,10 @@ for file in ../source/c/astronomy.c ../source/js/astronomy.ts ../source/python/a
|
||||
node trimspace.js ${file} || Fail "Cannot trim whitespace from target file: ${file}"
|
||||
done
|
||||
|
||||
echo "Patching C++ code for Arduino."
|
||||
cp -v ../source/c/astronomy.c ../source/arduino/astronomy.cpp || exit 1
|
||||
sed -i '/astro_time_t Astronomy_CurrentTime(void)/i #define ASTRONOMY_ENGINE_WHOLE_SECOND 1' ../source/arduino/astronomy.cpp || exit 1
|
||||
|
||||
# C# is a special case: we have to compile the code to get its documentation.
|
||||
echo "Building C# code to get documentation XML."
|
||||
cd dotnet/csharp_test || "Cannot change to directory dotnet/csharp_test"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2023 Don Cross <cosinekitty@gmail.com>
|
||||
Copyright (c) 2019-2024 Don Cross <cosinekitty@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -1000,7 +1000,6 @@ astro_time_t Astronomy_TerrestrialTime(double tt)
|
||||
* define the preprocessor symbol `ASTRONOMY_ENGINE_NO_CURRENT_TIME` to
|
||||
* exclude this function from your code.
|
||||
*/
|
||||
|
||||
#define ASTRONOMY_ENGINE_WHOLE_SECOND 1
|
||||
astro_time_t Astronomy_CurrentTime(void)
|
||||
{
|
||||
@@ -1022,7 +1021,7 @@ astro_time_t Astronomy_CurrentTime(void)
|
||||
#elif defined(ASTRONOMY_ENGINE_WHOLE_SECOND)
|
||||
sec = time(NULL);
|
||||
#else
|
||||
// #error Microsecond time resolution is not supported on this platform. Define ASTRONOMY_ENGINE_WHOLE_SECOND to use second resolution instead.
|
||||
#error Microsecond time resolution is not supported on this platform. Define ASTRONOMY_ENGINE_WHOLE_SECOND to use second resolution instead.
|
||||
#endif
|
||||
|
||||
/* Convert seconds to days, then subtract to get days since noon on January 1, 2000. */
|
||||
|
||||
Reference in New Issue
Block a user