8000 english readme · GyverLibs/UnixTime@8e2a7ec · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 8e2a7ec

Browse files
committed
english readme
1 parent bc93004 commit 8e2a7ec

File tree

1 file changed

+103
-87
lines changed

1 file changed

+103
-87
lines changed

README_EN.md

Lines changed: 103 additions & 87 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,122 @@
11
This is an automatic translation, may be incorrect in some places. See sources and examples!
22

3-
# UnixTime
4-
Converter unix time stamp to date and time and vice versa for Arduino. Based on:
5-
- https://www.oryx-embedded.com/doc/date__time_8c_source.html
6-
- https://stackoverflow.com/questions/7960318/math-to-convert-seconds-since-1970-into-date-and- vice- versa
3+
# Unixtime
4+
UNIX Time Stamp converter in date and time and vice versa for Arduino.Based on:
5+
- https://www.oryx-meded.com/doc/date__time_8c_Source.html
6+
-https://stackoveerflow.com/questions/7960318/math-to-Convert-Seconds-sincE-1970-Date-Date-VICE-VIRSA
7+
- http://lowardhinnant.github.io/date_algorithms.html#civil_from_days
78

8-
### Compatibility
9-
Compatible with all Arduino platforms (using Arduino functions)
9+
## compatibility
10+
Compatible with all arduino platforms (used arduino functions)
1011

1112
## Content
12-
- [Install](#install)
13-
- [Initialization](#init)
14-
- [Usage](#usage)
15-
- [Example](#example)
16-
- [Versions](#versions)
17-
- [Bugs and feedback](#feedback)
18-
19-
<a id="install"></a>
13+
- [installation] (# Install)
14+
- [initialization] (#init)
15+
- [use] (#usage)
16+
- [Example] (# Example)
17+
- [versions] (#varsions)
18+
- [bugs and feedback] (#fedback)
19+
20+
<a id="install"> </a>
2021
## Installation
21-
- The library can be found under the name **UnixTime** and installed via the library manager in:
22-
- Arduino IDE
23-
- Arduino IDE v2
24-
- PlatformIO
25-
- [Download Library](https://github.com/GyverLibs/UnixTime/archive/refs/heads/main.zip) .zip archive for manual installation:
26-
- Unzip and put in *C:\Program Files (x86)\Arduino\libraries* (Windows x64)
27-
- Unzip and put in *C:\Program Files\Arduino\libraries* (Windows x32)
28-
- Unpack and put in *Documents/Arduino/libraries/*
29-
- (Arduino IDE) automatic installation from .zip: *Sketch/Include library/Add .ZIP library…* and specify the downloaded archive
30-
- Read more detailed instructions for installing libraries [here] (https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE% D0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA)
31-
32-
<a id="init"></a>
33-
## Initialization
34-
```cpp
35-
UnixTimestamp(3); // specify GMT (for example, 3 for Moscow)
36-
```
37-
38-
<a id="usage"></a>
22+
- The library can be found by the name ** unixtime ** and installed through the library manager in:
23+
- Arduino ide
24+
- Arduino ide v2
25+
- Platformio
26+
- [download the library] (https://github.com/gyverlibs/unixtime/archive/refs/heads/main.zip) .Zip archive for manual installation:
27+
- unpack and put in * C: \ Program Files (X86) \ Arduino \ Libraries * (Windows X64)
28+
- unpack and put in * C: \ Program Files \ Arduino \ Libraries * (Windows X32)
29+
- unpack and put in *documents/arduino/libraries/ *
30+
- (Arduino id) Automatic installation from. Zip: * sketch/connect the library/add .Zip library ... * and specify downloaded archive
31+
- Read more detailed instructions for installing libraries [here] (https://alexgyver.ru/arduino-first/#%D0%A3%D1%81%D1%82%D0%B0%BD%D0%BE%BE%BE%BED0%B2%D0%BA%D0%B0_%D0%B1%D0%B8%D0%B1%D0%BB%D0%B8%D0%BE%D1%82%D0%B5%D0%BA)
32+
### Update
33+
- I recommend always updating the library: errors and bugs are corrected in the new versions, as well as optimization and new features are added
34+
- through the IDE library manager: find the library how to install and click "update"
35+
- Manually: ** remove the folder with the old version **, and then put a new one in its place.“Replacement” cannot be done: sometimes in new versions, files that remain when replacing are deleted and can lead to errors!
36+
37+
38+
<a id="init"> </a>
39+
## initialization
40+
`` `CPP
41+
Unixtime Stamp (3);// specify GMT (for example 3 for Moscow)
42+
`` `
43+
44+
<a id="usage"> </a>
3945
## Usage
40-
```cpp
41-
uint32_t getUnix(); // get unix stamp from set date and time
42-
void getDateTime(uint32_t t); // convert unix stamp date and time (to class member variables)
46+
`` `CPP
47+
uint32_t getunix ();// Get Unix Stamp from the set date and time
48+
VOID Getdatetime (Uint32_T T);// Convert UNIX Stamp Date and Time (in variable class members)
4349

44-
// setting the date and time (more convenient than writing variables in the wild)
45-
void setDateTime(uint16_t nyear, uint8_t nmonth, uint8_t nday, uint8_t nhour, uint8_t nminute, uint8_t nsecond);
50+
// setting the date and time (more convenient than writing VURT variables)
51+
VOID Setdetetime (Uint16_T Nyear, Uint8_T NMONTH, UINT8_T NDAY, UINT8_T NHOUR, UINT8_T NMINUTE, UINT8_T NSECOND);
4652

47-
// date and time variables
53+
// variable dates and time
4854
uint16_t year;
49-
uint8_tmonth;
55+
uint8_t months;
5056
uint8_t day;
51-
uint8_t hour;
57+
Uint8_t Hour;
5258
uint8_t minute;
5359
uint8_t second;
54-
uint8_tdayOfWeek;
55-
```
60+
uint8_t dayofweek;
61+
`` `
5662

57-
<a id="example"></a>
63+
<a id="EXAMPLE"> </a>
5864
## Example
59-
See **examples** for other examples!
60-
```cpp
61-
#include <UnixTime.h>
62-
63-
UnixTimestamp(3); // specify GMT (3 for Moscow)
64-
65-
void setup() {
66-
Serial.begin(9600);
67-
// ========= Date and time in UNIX ==========
68-
// setting the date and time of the library through the setDateTime function
69-
// setDateTime(year, month (since 1), day (since 1), hour, minute, second);
70-
// either stamp.year = 2021 and so on
71-
//stamp.setDateTime(2021, 1, 1, 0, 0, 0);
72-
stamp.setDateTime(2021, 5, 20, 7, 4, 15); // May 20, 2021, 07:04:15
73-
74-
// getUnix() - get unix time (running ~56 us on AVR)
75-
uint32_t unix = stamp.getUnix();
76-
Serial.println(unix);
77-
78-
// ========= UNIX to date and time ==========
79-
// convert unix to date and time
80-
// getDateTime(unix stamp) runs ~500 us on AVR
65+
The rest of the examples look at ** Examples **!
66+
`` `CPP
67+
#include <unixtime.h>
68+
69+
Unixtime Stamp (3);// specify GMT (3 for Moscow)
70+
71+
VOID setup () {
72+
Serial.Begin (9600);
73+
// ========= The date and time in unix =============
74+
// Installation of the date and time of the library through the Setdatetime function
75+
// setdateetime (year, month (from 1), day (from 1), hour, minute, second);
76+
// or Stamp.year = 2021 and so on
77+
//stamp.setdetetime(2021, 1, 1, 0, 0, 0);
78+
Stamp.Setdetetime (2021, 5, 20, 7, 4, 15);// 20 May 2021, 7:04:15
79+
80+
// getunix () - get unix time (executed ~ 56 us on avr)
81+
uint32_T Unix = Stamp.getunix ();
82+
Serial.println (unix);
83+
84+
// ========== Unix in date and time =============
85+
// Convert UNIX on date and time
86+
// getdetetime (unix Stamp) is performed ~ 500 us on avr
8187
// https://www.unixtimestamp.com/index.php
82-
stamp.getDateTime(1621497944);
83-
84-
// grab like this
85-
serial.println(stamp.year);
86-
Serial.println(stamp.month);
87-
serial.println(stamp.day);
88-
Serial.println(stamp.hour);
89-
serial.println(stamp.minute);
90-
serial.println(stamp.second);
91-
Serial.println(stamp.dayOfWeek); // Monday 1st, Sunday 7th
88+
Stamp.getDetetime (1621497944);
89+
90+
// Take it like this
91+
Serial.println (Stamp.year);
92+
Serial.println (Stamp.month);
93+
Serial.println (Stamp.day);
94+
Serial.println (Stamp.hour);
95+
Serial.println (Stamp.minute);
96+
Serial.println (Stamp.Second);
97+
Serial.println (Stamp.Dayofweek);// 1 Monday, 7 Sunday
9298
}
9399

94-
void loop() {
100+
VOID loop () {
95101
}
96-
```
97-
98-
<a id="versions"></a>
99-
## Versions
100-
- v1.0
101-
- v1.1 - optimization
102-
103-
<a id="feedback"></a>
104-
## Bugs and feedback
105-
When finding bugs, create **Issue**, or better yet, piSend cranberries to mail [alex@alexgyver.ru](mailto:alex@alexgyver.ru)
106-
The library is open for revision and your **Pull Request**'s!
102+
`` `
103+
104+
<a id="versions"> </a>
105+
## versions
106+
- V1.0
107+
- V1.1 - Optimization
108+
109+
<a id="feedback"> </a>
110+
## bugs and feedback
111+
Create ** Issue ** when you find the bugs, and better immediately write to the mail [alex@alexgyver.ru] (mailto: alex@alexgyver.ru)
112+
The library is open for refinement and your ** pull Request ** 'ow!
113+
114+
115+
When reporting about bugs or incorrect work of the library, it is necessary to indicate:
116+
- The version of the library
117+
- What is MK used
118+
- SDK version (for ESP)
119+
- version of Arduino ide
120+
- whether the built -in examples work correctly, in which the functions and designs are used, leading to a bug in your code
121+
- what code has been loaded, what work was expected from it and how it works in reality
122+
- Ideally, attach the minimum code in which the bug is observed.Not a canvas of a thousand lines, but a minimum code

0 commit comments

Comments
 (0)
0