<commit_before>package utils;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;

public class BuildTime
{
	public static String getBuildTime(){
		SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss");
		f.setTimeZone(TimeZone.getTimeZone("UTC"));
		return(f.format(getClassBuildTime()));
	}
	
	public static String getBuildDate(){
		SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
		f.setTimeZone(TimeZone.getTimeZone("UTC"));
		return(f.format(getClassBuildTime()));
	}
	
	public static String getBuildDateTime(){
		SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		f.setTimeZone(TimeZone.getTimeZone("UTC"));
		return(f.format(getClassBuildTime()));
	}
	
	private static Date getClassBuildTime() {
	    Date d = null;
	    Class<?> currentClass = new Object() {}.getClass().getEnclosingClass();
	    URL resource = currentClass.getResource(currentClass.getSimpleName() + ".class");
	    if (resource != null) {
	        if (resource.getProtocol().equals("file")) {
	            try {
	                d = new Date(new File(resource.toURI()).lastModified());
	            } catch (URISyntaxException ignored) { }
	        } else if (resource.getProtocol().equals("jar")) {
	            String path = resource.getPath();
	            d = new Date( new File(path.substring(5, path.indexOf("!"))).lastModified() );    
	        } else if (resource.getProtocol().equals("zip")) {
	            String path = resource.getPath();
	            File jarFileOnDisk = new File(path.substring(0, path.indexOf("!")));
	            //long jfodLastModifiedLong = jarFileOnDisk.lastModified ();
	            //Date jfodLasModifiedDate = new Date(jfodLastModifiedLong);
	            try(JarFile jf = new JarFile (jarFileOnDisk)) {
	                ZipEntry ze = jf.getEntry (path.substring(path.indexOf("!") + 2));//Skip the ! and the /
	                long zeTimeLong = ze.getTime ();
	                Date zeTimeDate = new Date(zeTimeLong);
	                d = zeTimeDate;
	            } catch (IOException|RuntimeException ignored) { }
	        }
	    }
	    return d;
	}
}<commit_msg>added cache for demanding determine the build date.<commit_after>package utils;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;

public class BuildTime
{
	private static String bufgetBuildTime = "";
	private static String bufgetBuildDate = "";
	private static String bufgetBuildDateTime = "";
	private static Date d = null;
	
	public static String getBuildTime(){
		if(bufgetBuildTime.equals(""))
		{
			SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss");
			f.setTimeZone(TimeZone.getTimeZone("UTC"));
			bufgetBuildTime = f.format(getClassBuildTime());
		}
		return(bufgetBuildTime);	
	}
	
	public static String getBuildDate(){
		if(bufgetBuildDate.equals(""))
		{
			SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
			f.setTimeZone(TimeZone.getTimeZone("UTC"));
			bufgetBuildDate = f.format(getClassBuildTime());
		}
		return bufgetBuildDate;
	}
	
	public static String getBuildDateTime(){
		if(bufgetBuildDateTime.equals(""))
		{
			SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			f.setTimeZone(TimeZone.getTimeZone("UTC"));
			bufgetBuildDateTime = f.format(getClassBuildTime()); 
		}
		return bufgetBuildDateTime;
	}
	
	private static Date getClassBuildTime() {
	    if(d == null)
	    {
	    	Class<?> currentClass = new Object() {}.getClass().getEnclosingClass();
	    	URL resource = currentClass.getResource(currentClass.getSimpleName() + ".class");
	    	if (resource != null) {
	    		if (resource.getProtocol().equals("file")) {
	    			try {
	    				d = new Date(new File(resource.toURI()).lastModified());
	    			} catch (URISyntaxException ignored) { }
		        } else if (resource.getProtocol().equals("jar")) {
		            String path = resource.getPath();
		            d = new Date( new File(path.substring(5, path.indexOf("!"))).lastModified() );    
		        } else if (resource.getProtocol().equals("zip")) {
		            String path = resource.getPath();
		            File jarFileOnDisk = new File(path.substring(0, path.indexOf("!")));
		            //long jfodLastModifiedLong = jarFileOnDisk.lastModified ();
		            //Date jfodLasModifiedDate = new Date(jfodLastModifiedLong);
		            try(JarFile jf = new JarFile (jarFileOnDisk)) {
		                ZipEntry ze = jf.getEntry (path.substring(path.indexOf("!") + 2));//Skip the ! and the /
		                long zeTimeLong = ze.getTime ();
		                Date zeTimeDate = new Date(zeTimeLong);
		                d = zeTimeDate;
		            } catch (IOException|RuntimeException ignored) { }
		        }
	    	}
	    }
	    return d;
	}
}
{'fraction_non_alphanumeric': 0.13372664700098327, 'fraction_numerical': 0.0011799410029498525, 'mean_word_length': 3.0655475619504395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4712438', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1494, 'n_words': 314}