- Set a color to the clock
- Set a color to the date
- Set a color for each digit individually
- Set a color to the clock colons
- Set a color only for the digits
- Use a custom date format
- Set a custom hour
- Set a custom minute
- Set a custom second
- Set a custom time using the format xx:xx:xx
- Set a custom day
- Set a custom month
- Set a custom year
- Set a custom date using the format DD/MM/YYYY
- Hide the seconds
- Hide the date
Running the program for the first time
Configuring a new color to the clock
This software is built using the following technologies:
- C programming language
- Meson build system
- Ncurses library
- Anemone library
Tests performed on this software:
- Unit testing
- Integration testing
The software has a documentation, the description of the documentation is a separate topic.
Here is all you need to know for installing the Rclock.
This software requires the following technologies to be installed in your machine:
The compiler used for developing the project was the GCC 13.2.1. Using the same compiler and the same version or newer is advisable.
The Meson build system documentation can be found on this link: https://mesonbuild.com/Getting-meson.html
The Ncurses library is also necessary to run the Rclock. This library is part of POSIX, so a Linux system typically has this library by default.
The Anemone is a library used for command-line argument parsing. This library is defined as a submodule of this repository, so you don't need to worry about downloading it manually, however, a couple of commands will be necessary to pull and compile the source code.
The source code of this repository can be downloaded with the following git command:
git clone --recursive https://github.com/Romulo-Moraes/Rclock.git
The --recursive flag is used for downloading the submodules beyond the repository source code.
The Anemone repository provides its own script for building the library, it's located on the root of the project. So to build the Anemone we need to run the following commands with the premise that you are currently at the root of the Rclock repository:
cd ./lib/Anemone
sh ./make_lib.sh
cd ../../
Once back to the Rclock root, we need to setup the Meson build system for compiling the repository. Use these commands to accomplish this task:
meson setup build
cd build
After setting up the Meson, there are two options for compilation.
This option just compiles the project and creates the executable in the current directory.
meson compile
This option compiles and also installs the executable globally on your machine.
sudo meson install
Once succesfully installed, the Rclock executable is visible globally and can now be run. To call the executable, simply type the following command in the terminal:
rclock
Running this command, the digital clock should be visible on screen with the default configurations.
One of the most attractive features of the Rclock is the ability of set new colors for each component, there's a variety of command-line flags that can define new colors for each piece of the clock.
The Rclock has a set of built-in colors that are available to be used in any Rclock component.
- black
- red
- green
- yellow
- blue
- magenta
- white
The Rclock is divided into components, this approach makes the development easier and increase the ways of customizations.
- Digits (Individually)
- Colons
- Date
This flag changes the color of all digits and all colons of the clock.
--clock-color or -c <color>
This flag changes the color of the date.
--date-color or -d <color>
The Rclock has the feature of change the color of each digit individually, this is compound by 6 flags. The digits are identified by a Roman number between 1 (I) and 6 (VI).
--color-I or -q <color>
--color-II or -Q <color>
--color-III or -P <color>
--color-IV or -p <color>
--color-V or -K <color>
--color-VI or -k <color>
This flag changes the color of both clock colons.
--colon-color or -o <color>
This flag changes the color of all clock digits.
--digits-color or -l <color>
It is possible to set a custom date to the Rclock, either individually or even using a date format.
The following flag sets a new day to the clock.
--custom-day or -D <month-day>
The following flag sets a new month to the clock.
--custom-month or -O <1-12>
The following flag sets a new year to the clock.
--custom-year or -Y <positive value>
The following flag sets a new day, month and year using a date format.
--custom-date or -D <DD/MM/YYYY>
By default, the date is shown using a built-in format, however you can declare a new date format and the Rclock will use this instead of the default format.
--date-format or -f <strftime format>
This feature uses the format of the strftime C function. Here is the cheatsheet to help you design your own format:
Specifier | Replaced By | Example |
---|---|---|
%a | Abbreviated weekday name | Sun |
%A | Full weekday name | Sunday |
%b | Abbreviated month name | Mar |
%B | Full month name | March |
%c | Date and time representation | Sun Aug 19 02:56:02 2012 |
%d | Day of the month (01-31) | 19 |
%H | Hour in 24h format (00-23) | 14 |
%I | Hour in 12h format (01-12) | 05 |
%j | Day of the year (001-366) | 231 |
%m | Month as a decimal number (01-12) | 08 |
%M | Minute (00-59) | 55 |
%p | AM or PM designation | PM |
%S | Second (00-61) | 02 |
%U | Week number with the first Sunday as the first day of week one (00-53) | 33 |
%w | Weekday as a decimal number with Sunday as 0 (0-6) | 4 |
%W | Week number with the first Monday as the first day of week one (00-53) | 34 |
%x | Date representation | 08/19/12 |
%X | Time representation | 02:50:06 |
%y | Year, last two digits (00-99) | 01 |
%Y | Year | 2012 |
%Z | Timezone name or abbreviation | CDT |
%% | A % sign | % |
The default format used by the project is the following:
"%A, %b %d %Y"
It is also possible to set a custom time to the Rclock, either individually or using a time format.
This flag sets a new hour to the clock.
--custom-hour or H <0-23>
This flag sets a new minute to the clock.
--custom-minute or-M <0-59>
This flag sets a new second to the clock.
--custom-second or -S <0-59>
This flag sets a new hour, minute and second using a time format.
--custom-time or -T <XX:XX:XX>
The Rclock can hide parts of itself to appear smaller than the normal.
This flag instructs the Rclock to hide the date until the end of its execution. This flag does not require a value.
--hide-date or -h
This flag instructs the Rclock to hide the seconds until the end of its execution. This flag does not require a value.
--hide-seconds or -i
This project was designed to hide the date and the seconds automatically, so whenever the terminal be small enough to can't display the entire clock, the seconds will be hidden if the width is not large enough and the date will be hidden if the height not be big enough.
This repository constains the whole software documentation inside the docs/ directory. The documentation is divided into three kinds of files:
- Requirements document
- The general Rclock documentation
- The documentation of each Rclock module
The documentation files are designed to help developers understand the project when creating new functionalities or for maintenance purposes.