Can we make second() or minute() time funct

Can we make second() or minute() time function zero while running. I have to work that when robot turn left or right store the that time and the the timer should start from zero that after let suppose 1 minute the robot turn left then it will store 1 minute and then restart the timer function??

Yes, that's fine.
You don't need to ask permission - it's open source

Yes

Please investigate the functions delay() and millis(). They are both covered in the online documentation.

So how to do that i mean ?

Your problem description is too vague. You have to make it clearer, and more explicit if you want help.

So, Basically as per my concept when the arduino is powed up the the timer start let the second() function start. And it will continue , I want it to be zero when first condition true like that i said earlier when robot turn left note that time and make the second() start from zero then..

URduino:
So, Basically as per my concept

Will you write the code or will 'we' be writing the code for you?

URduino:
So, Basically as per my concept when the arduino is powed up the the timer start let the second() function start. And it will continue , I want it to be zero when first condition true like that i said earlier when robot turn left note that time and make the second() start from zero then..

If English is not your first language, no problem. It is very common on an international forum. But you will have to be more clear. Try to break it down to steps, where each step and condition is fully explained.

Forget any ideas you have about "seconds()" functions or such. Just explain what you want to do.

so let just see this code, If after the while loop if I want the timer that is second function to reset again then i mean how to do that

int p=0;
int K=0;
#include<TimeLib.h>
void setup() {
  Serial.begin(9600);
  
}

void loop() {
  while(p<50){
    K=second();
  Serial.println(K);
  p++;
  delay(100);
  }
  K=0;
  p=0;
  Serial.println("Reset");

}

Please post a complete sketch, not just a snippet.

OK, So now I am posting my code. First of all explaining this code.

  1. This function will store the seconds and minute in one byte , I have to store the time in 1 byte but as far as I know uptill now I made this seconds equal to maximum 31 sec to have it in one byte . So after that time is stored in payload array the I have to restart the RTC second value.
void tim(){
  int k=0;
  timer= second();
  count=minute();
  Serial.println(timer);
  //data +=1;
  //payload=25;
  //data +=1;
  //Serial.println(timer);
  if(timer>32){
    timer=31;
  }
  
  if(count==1) 
   {
    pay = byte(count << 7);
   }
   if(count==2 || count==3){
    pay = byte(count<<6);
   }
   if(count==5 ||count==6 || count==7){
    pay==byte(count<<5);
   }
    while(k==0){
  //pay = byte(count & 0x70);
//payload = byte(timer << 4);
Serial.print((String)"time is " +count+ " minute " +timer+ " second :");
  Serial.println(byte (pay | timer ));
  payload[x1]=(byte (pay | timer ));
 pay=0;
  x1 += byte(1);
  k=1;
    }
  
  }

Here is a RunTime timer I did a while back. The timer is triggered by a hardware timer releasing a event trigger once a second. The run time is kept in a structure.

SemaphoreHandle_t sema_RunTime;
QueueHandle_t xQ_RunTimeMessage;
struct stuRunTimeData
{
  int iSeconds;
  int iMinutes;
  int iHours;
} xRunTimeData;
////
void IRAM_ATTR onTimer()
{
  BaseType_t xHigherPriorityTaskWoken;
  iTicCount++;
  //
  if ( (xSemaphoreTakeFromISR(sema_GPS_Gate, &xHigherPriorityTaskWoken)) == pdTRUE ) // grab semaphore, no wait
  {
    xEventGroupSetBitsFromISR(eg, GPS_Parse, &xHigherPriorityTaskWoken); // trigger every 1mS, if not already processing
  }
  if ( iTicCount == OneK )
  {
    xEventGroupSetBitsFromISR(eg, OneSecondGroupBits, &xHigherPriorityTaskWoken); // trigger every 1X a second
    // reset counter to start again
    iTicCount = 0;
  }
} // void IRAM_ATTR onTimer()
//
void setup ()
{
 timer = timerBegin( TIMER_FOUR, TimerDivider, true );
  timerAttachInterrupt( timer, &onTimer, true );
  timerAlarmWrite(timer, OneK, true);
  timerAlarmEnable(timer);
  //
   xQ_RunTimeMessage = xQueueCreate( 1, sizeof(struct stuRunTimeData*) ); //sends a queue pointer to the structure
  //
   xTaskCreatePinnedToCore( fRunTime, "fRunTime", TaskStack10K2, NULL, Priority4, NULL, TaskCore0 ); 
  sema_RunTime = xSemaphoreCreateMutex();
  xSemaphoreGive( sema_RunTime );
}
////
void fRunTime( void * parameter )
{
  struct stuRunTimeData *pxMessage;
  for (;;)
  {
    xEventGroupWaitBits (eg, RunTimeEvent, pdTRUE, pdTRUE, portMAX_DELAY) ;
    if ( xSemaphoreTake( sema_RunTime, xSemaphoreTicksToWait ) == pdTRUE )
    {
      xRunTimeData.iSeconds++;
      if ( xRunTimeData.iSeconds == 60 )
      {
        xRunTimeData.iMinutes++;
        xRunTimeData.iSeconds = 0;
      }
      if ( xRunTimeData.iMinutes == 60 )
      {
        xRunTimeData.iHours++;
        xRunTimeData.iMinutes = 0;
      }
      pxMessage = &xRunTimeData;
      xQueueOverwrite( xQ_RunTimeMessage, (void *) &pxMessage );
      xSemaphoreGive( sema_RunTime );
    }
    // Serial.println( "fRunTime" );
    //    Serial.print( "fRunTime " );
    //    Serial.print(uxTaskGetStackHighWaterMark( NULL ));
    //    Serial.println();
    //    Serial.flush();
  }
  vTaskDelete( NULL );
} // void fRunTime( void * parameter )

Do you care what the actual time is when events occur or just the elapsed time between them ?

Suppose that something happens at 31 seconds and you want something else to happen 60 seconds later. Just test for 31 + 60 (ie 91) seconds and then take the action. Similarly if you want to time how long the period between events is then subtract the start time from the event time

Milliis() is perfect for tasks like this where you do not need to know the actual time only the relative time between events. Take a look at Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

URduino:
OK, So now I am posting my code. First of all explaining this code.

  1. This function will store the seco

No, you're posting another snippet.

UKHeliBob:
Do you care what the actual time is when events occur or just the elapsed time between them ?

Suppose that something happens at 31 seconds and you want something else to happen 60 seconds later. Just test for 31 + 60 (ie 91) seconds and then take the action. Similarly if you want to time how long the period between events is then subtract the start time from the event time

Milliis() is perfect for tasks like this where you do not need to know the actual time only the relative time between events. Take a look at Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

Yeah I am concern with the actual time untill the first event happen. After that for second event the timer will restart from zero and for next event the next value of the actual time I want to store. That what I want to do.

When you start read millis() and store it in time[0], when you turn read millis() store it in time[1] etc..
The index lets you know the number of turns you've made. Then you can subtract two of your array variables to find out the elapsed time between turns. It will also let you go back the way you came if you can also store direction (angle). Your speed would have to be constant for retracing where you came from.

If you really insist on timing using the Time Library, you should be using epoch times, not YYMMDDHHMMSS times.

Yeah I am concern with the actual time untill the first event happen

That is taken care of by saving the start time and subtracting that from the event time, just like any other event

Do you mean like:

unsigned long minutes() {
  return millis() / (1000L*60);
}