Comments (9)
Please do submit a PR! I am no longer very actively maintaining this code, so community support is much appreciated.
from ds3231.
Overloading might be desirable. If @namanvs would submit a PR I would be happy to review it.
It may be worth noting, however, that such comparisons and arithmetic can be done presently without overloading. The approach would be to calculate a difference in seconds, taking advantage of the DateTime::unixtime()
method.
Code segment:
DateTime A(); // assume initiated properly
DateTime B(); // assume initiated properly
uint32_t a = A.unixtime();
uint32_t b = B.unixtime
if (a > b) { // A is after B }
uint32_t diff = a - b;
from ds3231.
Good point @IowaDave.
I don't have need for this overloading so won't be dev'ing it. How about this as a plan?
- If we hear from @namanvs soon-ish about creating a PR, great
- Otherwise, we close this as
wontfix
with reason "not enough current motivation"
from ds3231.
Hi @awickert and @IowaDave, sorry, I've been travelling but I would be happy to write these operators. I will need about 10 days to get back up to speed and have something ready, but I plan on implementing the following operators: '<', '>', '+', and '-'. I'll probably use @awickert 's suggested strategy but wrap it up into the operators for convenience. I am toying with a modulo operator to return the remainder between 2 operands in the next-smallest unit:
DateTime a % DateTime::DAYS returns number of hours in the remainder.
Would this seem useful?
from ds3231.
from ds3231.
@namanvs , @awickert , I have added the DateTime documentation to the master branch of this repo. In the near future, PR #70 may add an example program that uses a DateTime calculation to advance the time values of an alarm.
I'll look forward to viewing that PR you mentioned, if you choose to offer it.
Thank you sincerely,
David
from ds3231.
I have submitted a PR. This is actually the first time I'm contributing to code on Github. Open to feedback and willing to make improvements where identified.
from ds3231.
@namanvs Welcome! I look forward to reviewing your code.
Please see my comments in the PR (#71). Thanks!
from ds3231.
Changed the label to Enhancement because that is really what @namanvs is proposing. Leaving this Issue open pending resolution of his PR #71.
cc: @awickert
from ds3231.
Related Issues (20)
- [Question]: get Epoch value from DS3231 possible? HOT 3
- New Release Missing HOT 1
- Update to 1.10. brocke compling, but it work with old library V1.0.7 ! HOT 8
- Not compiling HOT 1
- AlarmBits parameter not initialized in getA1Time and getA2Time
- setEpoch() does not work with Unix Time but with time since 01/01/2000 00:00:00 HOT 13
- DS3231_test:16:8: error: 'DS3231 clock' redeclared as different kind of symbol DS3231 clock; ^~~~~ HOT 1
- Added Changelog HOT 1
- Compile errors with recent getAXAlarm() and checkIfAlarm() overloads HOT 1
- New versions are not published to Arduino library manager HOT 1
- DateTime class accepts type-conflicting assignments HOT 3
- Wrong text in DS3231/Documentation/Time-Retrieval.md HOT 1
- DateTime constructor crashes SAMD21 HOT 1
- Year 2106 potential problem? HOT 1
- Cannot find any mention of which day of the week is 1 HOT 1
- About the DS3231 in readme.md has broken link
- OSF flag needs independent reset function.
- undefined reference to DateTime::dayOfTheWeek() HOT 3
- [Question]: Why do we use yOff instead use the Year In DateTime? HOT 5
- no .begin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ds3231.