-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ALS-5755] Switch time series processor to ISO timestamps
- Make service that does this - Isolate time series logic a bit more - Tests
- Loading branch information
Luke Sikina
committed
Jan 23, 2024
1 parent
c6d8296
commit 35797d0
Showing
5 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...edu/harvard/hms/dbmi/avillach/hpds/processing/timeseries/TimeSeriesConversionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.processing.timeseries; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import java.time.Instant; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
@Service | ||
public class TimeSeriesConversionService { | ||
|
||
public String toISOString(Long unixTimeStamp) { | ||
Instant instant = Instant.ofEpochMilli(unixTimeStamp); | ||
return DateTimeFormatter.ISO_INSTANT.format(instant); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...harvard/hms/dbmi/avillach/hpds/processing/timeseries/TimeSeriesConversionServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package edu.harvard.hms.dbmi.avillach.hpds.processing.timeseries; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.TimeZone; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
|
||
public class TimeSeriesConversionServiceTest { | ||
|
||
TimeSeriesConversionService subject = new TimeSeriesConversionService(); | ||
|
||
@Test | ||
public void shouldConvertToIsoString() { | ||
String actual = subject.toISOString(0L); | ||
String expected = "1970-01-01T00:00:00Z"; | ||
|
||
assertEquals(expected, actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters