Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
856 B

import * as Highlight from '../constants/Highlight';
export const NTP_TIME_NOT_SET = 0;
export const NTP_TIME_NEEDS_SYNC = 1;
export const NTP_TIME_SET = 2;
export const isSynchronized = ntpStatus => ntpStatus && (ntpStatus.status === NTP_TIME_NEEDS_SYNC || ntpStatus.status === NTP_TIME_SET);
export const ntpStatusHighlight = ntpStatus => {
switch (ntpStatus.status){
case NTP_TIME_SET:
return Highlight.SUCCESS;
case NTP_TIME_NEEDS_SYNC:
return Highlight.WARN;
case NTP_TIME_NOT_SET:
default:
return Highlight.ERROR;
}
}
export const ntpStatus = ntpStatus => {
switch (ntpStatus.status){
case NTP_TIME_SET:
return "Synchronized";
case NTP_TIME_NEEDS_SYNC:
return "Synchronization required";
case NTP_TIME_NOT_SET:
return "Time not set"
default:
return "Unknown";
}
}