Skip to content

PR test#1

Open
kber-ps wants to merge 4 commits intomainfrom
feature1
Open

PR test#1
kber-ps wants to merge 4 commits intomainfrom
feature1

Conversation

@kber-ps
Copy link
Copy Markdown
Owner

@kber-ps kber-ps commented Apr 28, 2025

Test reviewdog

Comment on lines +39 to +46
void display_time_diff(time_t time1, time_t time2)
{
char buf[BUF_SIZE];
time_t the_time = time2 - time1;
char t = ctime(&the_time);

sprintf(buf, "\n\nTime difference is %s\n\n", t);
print_string(buf);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format-pr] reported by reviewdog 🐶

Suggested change
void display_time_diff(time_t time1, time_t time2)
{
char buf[BUF_SIZE];
time_t the_time = time2 - time1;
char t = ctime(&the_time);
sprintf(buf, "\n\nTime difference is %s\n\n", t);
print_string(buf);
void display_time_diff(time_t time1, time_t time2) {
char buf[BUF_SIZE];
time_t the_time = time2 - time1;
char t = ctime(&the_time);
sprintf(buf, "\n\nTime difference is %s\n\n", t);
print_string(buf);

sprintf(buf, "\n\nTime difference is %s\n\n", t);
print_string(buf);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format-pr] reported by reviewdog 🐶

Suggested change

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format-pr] reported by reviewdog 🐶

ghdemo/clock.c

Lines 26 to 33 in 540b7cc

void display_time_diff_from_now(time_t old_time)
{
char buf[BUF_SIZE];
time_t the_time = old_time - time(NULL);
char t = ctime(&the_time);
sprintf(buf, "\n\nCurrent Time and Date is %s\n\n", t);
print_string(buf);

* Print the time diff from current time
*/
void display_time_diff(time_t old_time)
void display_time_diff_from_now(time_t old_time)

Check failure

Code scanning / C/C++test

A declaration shall be visible when an object or function with external linkage is defined Error

Prototype of function 'display_time_diff_from_now' does not precede function definition
* Print the time diff from current time
*/
void display_time_diff(time_t old_time)
void display_time_diff_from_now(time_t old_time)

Check failure

Code scanning / C/C++test

The types defined in the library <time.h> shall not be used Error

The 'time_t' identifier should not be used
/*
* Print the time difference
*/
void display_time_diff(time_t time1, time_t time2)

Check failure

Code scanning / C/C++test

A declaration shall be visible when an object or function with external linkage is defined Error

Prototype of function 'display_time_diff' does not precede function definition
/*
* Print the time difference
*/
void display_time_diff(time_t time1, time_t time2)

Check failure

Code scanning / C/C++test

The types defined in the library <time.h> shall not be used Error

The 'time_t' identifier should not be used
/*
* Print the time difference
*/
void display_time_diff(time_t time1, time_t time2)

Check failure

Code scanning / C/C++test

The types defined in the library <time.h> shall not be used Error

The 'time_t' identifier should not be used
{
char buf[BUF_SIZE];
time_t the_time = time2 - time1;
char t = ctime(&the_time);

Check warning

Code scanning / C/C++test

A conversion should not be performed between a pointer to object and an integer type Warning

Pointer to object type 'char *' should not be converted to integral type 'char'
{
char buf[BUF_SIZE];
time_t the_time = time2 - time1;
char t = ctime(&the_time);

Check failure

Code scanning / C/C++test

The time handling functions and macros of the library <time.h> shall not be used Error

Usage of 'ctime' function is not allowed
time_t the_time = time2 - time1;
char t = ctime(&the_time);

sprintf(buf, "\n\nTime difference is %s\n\n", t);

Check failure

Code scanning / C/C++test

The input/output functions from the 'cstdio' and 'cwchar' libraries should not be used Error

The 'sprintf' library function should not be used
time_t the_time = time2 - time1;
char t = ctime(&the_time);

sprintf(buf, "\n\nTime difference is %s\n\n", t);

Check failure

Code scanning / C/C++test

The value returned by a function having non-void return type shall be used Error

Unused function's "sprintf" return value
char t = ctime(&the_time);

sprintf(buf, "\n\nTime difference is %s\n\n", t);
print_string(buf);

Check failure

Code scanning / C/C++test

The value returned by a function having non-void return type shall be used Error

Unused function's "print_string" return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant