diff --git a/Notes.md b/Notes.md new file mode 100644 index 0000000..325cea3 --- /dev/null +++ b/Notes.md @@ -0,0 +1,40 @@ +# Notes for SerialLogger + +## Timestamp function +SerialLogger offers since v1.1.0 a timestamp function which add a timestamp in front of every data line. The user can choose from a lot of predefined formats. Furthermore the user can choose from a couple delimiter signs which separate the timestamp components and the data from each other. This makes it easier to import the data to post-processing applications. + +### Delimiter signs +The delimiter sign is added between timestamp components (if necessary) and at the end of the timestamp just before the data +- blank (*space character*) +- comma (,) +- semicolon (;) + +### Timestamp formats +- *ISO 8601:* + Format: ```2018-09-06T13:45:42+0200``` => 1:45:42pm at September 6th, 2018 CEST (Central European Summer Time) +- *Date|Time|Timezone:* + Format: ```06.09.2016,13:45:42,+0200``` => 1:45:42pm at September 6th, 2018 CEST, comma is the delimiter +- *Date|Time:* + Format: ```06.09.2016,13:45:42``` => 1:45:42pm at September 6th, 2018, comma is the delimiter +- *Time:* + Format: ```13:45:42``` => 1:45:42pm +- *Mod. Julian Day:* The Modified Julian Day (MJD) is an abbreviated version of the old Julian Day (JD) dating method + which has been in use for centuries by astronomers, geophysicists, chronologers, and others who needed to have an + unambiguous dating system based on continuing day counts. MJD counts days from November 17, 1858 onwards and starts, + in comparison to the JD, at midnight. Time is displayed as a fraction of a day. It is easy to calculate time differences. + Format: ```58393.431814675925``` => 10:21:48am at October 2nd, 2018 CEST +- *Year|Day of year|Time:* The Day of the year is the counted day from Jan. 1st = 1 onwards till 365 or 366 resp. This + Format: ```2018 275 10:21:48``` => 10:21:48am at October 2nd, 2018, [blank] is the delimiter +- *Year|month|day|hours|minutes|seconds|timezone:* This timestamp offers all standard date and time components in + sepratate fields for easier post-processing handling + Format: ```2018 10 2 10 21 48 +0200``` => => 10:21:48am at October 2nd, 2018 CEST, [blank] is the delimiter + +## Settings storage +*WINDOWS:* Settings are stored in the regitry (regedit.exe) in the key: +```Computer\HKEY_CURRENT_USER\Software\JavaSoft\Prefs\de\haniibrahim\seriallogger``` + +*UNIX, GNU/Linux:* Settings are stored in user's home directory in the file: +```~/.java/.userPrefs/de/haniibrahim/seriallogger/prefs.xml``` + +*macOS:* Settings are stored in user's library directory in the file: +```~/Library/Preferences/de.haniibrahim.seriallogger.plist``` \ No newline at end of file diff --git a/README.md b/README.md index 1142b0b..adfc9a0 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ * Hardware (CTS/RTS) and Software (Xon/Xoff) handshake available ## Screenshot -![](http://blog.hani-ibrahim.de/wp-content/uploads/seriallogger-1.0.0-beta_windows.png "Screenshot") +![](http://blog.hani-ibrahim.de/wp-content/uploads/Seriallogger-1.1.0-alpha.png "Screenshot") -SerialLogger v1.0.0 on Windows 10 +SerialLogger v1.1.0-alpha on Windows 10 ## Requirements @@ -47,6 +47,7 @@ For JARs and platform related installers go to the [RELEASE](https://github.com/ | 0.9.0 | Basic logging functions and serial settings, fail-proof log file feature, full cross-platform functionality (Windows, macOS, GNU/Linux) | | 1.0.0-beta | Hardware (CTS/RTS) and Software (Xon/Xoff) flowcontrol option, append data to existing file feature, invalid path bug fixed, warning of overwriting unsaved/unlogged buffer at new connections| | 1.0.0 | Check & warn for unsaved/unlogged puffer at app closing, empty commport bug fixed, flowcontrol bug fixed, filedialog bug fixed on macOS & Windows, code clean-up | +| 1.1.0-alpha | Timestamp feature | ## Roadmap diff --git a/To-Do.txt b/To-Do.txt index d2b48e8..3a229a6 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -6,6 +6,6 @@ [x] Get rid of the cosmetic "Empty Commport" GUI bug [x] Warning when close window/quit app and buffer is not empty and not logged. [x] Flowcontrol bug fixed -[ ] Timestamp feature +[x] Timestamp feature [ ] Save option for buffer [ ] CLI interface diff --git a/de/haniibrahim/seriallogger/Helper.java b/de/haniibrahim/seriallogger/Helper.java index 8bb434d..bb5a5d8 100644 --- a/de/haniibrahim/seriallogger/Helper.java +++ b/de/haniibrahim/seriallogger/Helper.java @@ -47,11 +47,12 @@ static String getOS() { } /** - * Return a timestamp in ISO 8601, format: yyyy-MM-dd'T'HH:mm:ssZ, delimiter - - Example: 2018-09-06T13:45:42+0200 1:45:42pm at September 6th, 2018 CEST - (Central European Summer Time) - * + * Return a timestamp in ISO 8601, format: yyyy-MM-dd'T'HH:mm:ssZ, delimiter + * + * Example: 2018-09-06T13:45:42+0200 1:45:42pm at September 6th, 2018 CEST + * (Central European Summer Time) + * + * @param delimiter Separator sign (e.g. [blank],[,],[;]) * @return ISO 8601 timestamp */ static String getIsoTimestamp(String delimiter) { @@ -62,13 +63,13 @@ static String getIsoTimestamp(String delimiter) { } /** - * Return a timestamp formated as date, sepearator, time, delimiter - timezone, delimiter - - This format is excellent to process data in spreadsheets apps - - Example: 06.09.2016,13:45:42,+0200 1:45:42pm at September 6th, 2018 CEST, - comma is the delimiter + * Return a timestamp formated as date, sepearator, time, delimiter + * timezone, delimiter + * + * This format is excellent to process data in spreadsheets apps + * + * Example: 06.09.2016,13:45:42,+0200 + * 1:45:42pm at September 6th, 2018 CEST, comma is the delimiter * * @param delimiter Separator sign (e.g. [blank],[,],[;]) * @return date/delimiter/time timestamp @@ -86,11 +87,11 @@ static String getDateTimeTz(String delimiter) { /** * Return a timestamp formated as date, sepearator, time, delimiter - - This format is excellent to process data in spreadsheets apps - - Example: 06.09.2016,13:45:42 1:45:42pm at September 6th, 2018, comma is - the delimiter + * + * This format is excellent to process data in spreadsheets apps + * + * Example: 06.09.2016,13:45:42 + * 1:45:42pm at September 6th, 2018, comma is the delimiter * * @param delimiter Separator sign (e.g. [blank],[,],[;]) * @return date/delimiter/time timestamp @@ -107,7 +108,7 @@ static String getDateTimeTimestamp(String delimiter) { * This format is excellent to process data in spreadsheets apps * * Example: 13:45:42 - * 1:45:42pm at September 6th, 2018 + * 1:45:42pm * * @param delimiter Separator sign (e.g. [blank],[,],[;]) * @return date/delimiter/time timestamp @@ -124,7 +125,7 @@ static String getTimeTimestamp(String delimiter) { * 1:45:42pm at September 6th, 2018 (day 249 of 2018) * * @param delimiter Separator sign (e.g. [blank],[,],[;]) - * @return + * @return day of the year timestamp */ static String getDayOfYearTimestamp(String delimiter){ Calendar cal = Calendar.getInstance(); // get current date and time @@ -135,7 +136,15 @@ static String getDayOfYearTimestamp(String delimiter){ + Integer.toString(cal.get(Calendar.SECOND)) + delimiter; } - + /** + * Return timestamp in seperate date and time components incl. timezone + * + * Example: 2018 10 2 10 21 48 +0200 + * 10:21:48am at October 2nd, 2018 CEST, [blank] is the delimiter + * + * @param delimiter Separator sign (e.g. [blank],[,],[;]) + * @return Year|month|day|hours|minutes|seconds|timezone timestamp + */ static String getYMDhmsTz(String delimiter){ Calendar cal = Calendar.getInstance(); // get current date and time @@ -157,7 +166,7 @@ static String getYMDhmsTz(String delimiter){ * Returns timestamp as modified Julian Date including time as floating point * * @param delimiter Separator sign (e.g. [blank],[,],[;]) - * @return + * @return Modified Julian Date timestamp */ static String getMjd(String delimiter) { Calendar cal = Calendar.getInstance(); // get current date and time