Skip to content

Commit

Permalink
Deprecated Time to ISO8601 method.
Browse files Browse the repository at this point in the history
Convert to Instant and then to ISO8601
  • Loading branch information
slacmshankar committed Sep 11, 2019
1 parent 0cf3071 commit 1a213d9
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
import java.net.URL;
import java.net.URLEncoder;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.xml.bind.DatatypeConverter;

/**
* Client side class for retrieving data from the appliance archiver using the PB over HTTP protocol.
* @author mshankar
Expand Down Expand Up @@ -98,9 +94,7 @@ public GenMsgIterator getDataForPV(String pvName, Timestamp startTime, Timestamp

private static String convertToUTC(Timestamp time) {
try {
Calendar c = GregorianCalendar.getInstance();
c.setTime(time);
return URLEncoder.encode(DatatypeConverter.printDateTime(c), "UTF-8");
return URLEncoder.encode(time.toInstant().toString(), "UTF-8");
} catch (UnsupportedEncodingException ex) {
logger.log(Level.SEVERE, "Cannot encode times into UTF-8", ex);
return null;
Expand Down

0 comments on commit 1a213d9

Please sign in to comment.