Converting 13 decimals to datetime C++ : I have a project about cars with GPS. I need to return the start and the finish moment for each car. Please help me!

So we have :
time_t x, y;
Because I will use later them for a transformation.

     
    
    I have a problem! I read from an external file data in this format:
    auto1
    1439467747492 
    auto1
    1439467748512
    ......etc.
    auto1->name of the car;  1439467747492->the moment in time of the car
    
    I tried to get the first position of the first moment and the last moment  for each car. This is the code in C++:
    
        void raportDistanta(/**/, long long momenti[], long long momentf[])
        n=m=1;
        if (g.is_open())
        	{
        		//momenti,momentf---arrays type long long because a moment has 13 digits
        		//momenti=saves the start  moments for each car
        		//momentf=saves the final moments for each car
        		momenti[n++] = a[0].getMoment();
        		for (i = 0; i < nr - 1; i++)
        		{
        			if (strcmp(a[i].getnume(), a[i + 1].getnume()) == 0)
        			{
        				//here i try to get the distance between two points. The car in the moment i and i+1
                             // I failed doing that...I don't transform the latitude and longitude properly and I get bad numbers. anyway....
        			}
        			else
        			{ //Here I put 
        				momenti[n++] = a[i + 1].getMoment();
        				momentf[m++] = a[i].getMoment();
        				
        			}
        		}
        		momentf[m++] = a[nr1].getMoment();
    
    
    After this i do in main something like that:
    **
    
        x = momenti[choice1] / 1000;
    y = momentf[choice1] / 1000;
    cout << "     Moment i:\n " << ctime(&x) << " Moment final: \n" << ctime(&y) << endl;
    
    
    
    I receive the same date for every car. Is something like momenti[i]=momentf[i]
    What I did wrong? Thanks!