According to the code provided, there are a few hypotheses that I might think of.
Since you said that you are not getting any output I would formulate that this code might not even being executed. The reason for my statement relies on the following two pieces of your code:
//start time
int scrollStartTime = 0 ;
//end time
int scrollEndTime = 0 ;
(...)
//get the time gap take to change images
int scrollerTime = scrollEndTime - scrollStartTime ;
System.out.println(scrollerTime);
This means that even if the list is empty and your for loop is not run you at least would see the number zero (0) provided in your terminal.
Lets assume for now that indeed the zero (0) appears in your terminal but you didn't noticed, so the issue might rely on the for loop. The reason why is that you're are stating that you have a list of 2 elements (considering that indeed your list is not empty) but the time to iterate a 2 element list is almost instant, so there is a high change that your code already finished iterating without any of the items even being selected, this means that none of the if statements is executed. (you might want consider using breakpoints to confirm that)
Since I don't have the full insight of the application you're trying to test it is hard to provide you a concrete answer but you might want to change your logic to wait for when the specific event occurs and capture its time (in this case the specific button is selected). Below I try to provide a working example that possibly may solve your problem and give you an answer to the time that it takes to move the carousel. (in the example instead of a selected element, I wait for an element with known attribute but the principle that you have to apply is very similar)
Please note that the code provided below doesn't follow the correct practice for coding a good automation and it is only to provide a quick example of what you might do, so consider adapting it to a correct practice.
//element selectors
@FindBy(xpath = "//div[@id='carouselExampleCaptions']")
private WebElement carouselElementContainer;
@FindBy(xpath = "//div[@id='carouselExampleCaptions']//div[@class='carousel-inner']/div")
private List<WebElement> carouselElements;
(...)
public void deltaTimeForCarouselElementSelect(){
//site with carousel that automatically switch images
driver.get("https://getbootstrap.com/docs/4.0/components/carousel/");
WebDriverWait driverWait = new WebDriverWait(driver, Duration.of(15, ChronoUnit.SECONDS));
driverWait.until(ExpectedConditions.visibilityOf(carouselElementContainer));
driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(0), "class", "carousel-item active"));
double time1 = getMilliSecTime();
System.out.printf("Time for first event: %s milliseconds %n", time1);
driverWait.until(ExpectedConditions.attributeContains(carouselElements.get(carouselElements.size() - 1), "class", "active"));
double time2 = getMilliSecTime();
System.out.printf("Time for last event: %s milliseconds %n", time2);
double DeltaInMilli = time2 - time1;
System.out.printf("Time that took between the two events - %f milliseconds %n", DeltaInMilli);
}
private long getMilliSecTime(){
Date date = new Date();
return date.getTime();
}
Running this method will provide a similar output as the one displayed below:
Time for first event: 1.654638603088E12 milliseconds
Time for last event: 1.654638613128E12 milliseconds
Time that took between the two events - 10040.000000 milliseconds