This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

date/time as string

I have the following code that sets the date & time:

date_time_get_current_time(¤t_time);
if(current_time.hours > 4 && current_time.hours <10)
{

When the device boots, time will be set 0 (2017.01.01-00:00:00)

In order to test this function I need to insert the date/time as a string.
How can I accomplish this?

Also, how can I write the PC date/time to ¤t_time?

Sorry for all the questions but I am a noobie.

  • Read it on the PC and send it via a serial port, parse it on the device side? The problem is poorly framed.

    Where would it normally get set? Are you testing the code on a PC? Can you test portions of it on a PC?

    What's t_time? Like time_t but different?

    #include <time.h>
    
    {
        time_t tt;
        char *date;
    
        time(&tt); // Get current time
    
        date = ctime(&tt); // Local Time in ASCII
    
        puts(date);
    }
    

    >>I am a noobie
    Ok, but what does that mean? You're twelve, you have a high school diploma or a college degree in modern art? Give us some frame of reference here.