mirror of https://github.com/curusarn/resh
parent
4383d2b30a
commit
7d87c38d03
@ -0,0 +1,14 @@ |
|||||||
|
package epochtime |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
func TimeToString(t time.Time) string { |
||||||
|
return fmt.Sprintf("%.2f", float64(t.UnixMilli())/1000) |
||||||
|
} |
||||||
|
|
||||||
|
func Now() string { |
||||||
|
return TimeToString(time.Now()) |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
package epochtime |
||||||
|
|
||||||
|
import ( |
||||||
|
"strconv" |
||||||
|
"testing" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
func TestConversion(t *testing.T) { |
||||||
|
epochTime := "1672702332.64" |
||||||
|
seconds, err := strconv.ParseFloat(epochTime, 64) |
||||||
|
if err != nil { |
||||||
|
t.Fatal("Test setup failed: Failed to convert constant") |
||||||
|
} |
||||||
|
if TimeToString(time.UnixMilli(int64(seconds*1000))) != epochTime { |
||||||
|
t.Fatal("EpochTime changed during conversion") |
||||||
|
} |
||||||
|
} |
||||||
@ -1,27 +0,0 @@ |
|||||||
#!/hint/sh |
|
||||||
|
|
||||||
# util.sh - resh utility functions |
|
||||||
|
|
||||||
__resh_session_init() { |
|
||||||
if [ "$__RESH_VERSION" != "$(resh-session-init -version)" ]; then |
|
||||||
# shellcheck source=shellrc.sh |
|
||||||
source ~/.resh/shellrc |
|
||||||
if [ "$__RESH_VERSION" != "$(resh-session-init -version)" ]; then |
|
||||||
echo "RESH WARNING: You probably just updated RESH - PLEASE RESTART OR RELOAD THIS TERMINAL SESSION (resh version: $(resh-session-init -version); resh version of this terminal session: ${__RESH_VERSION})" |
|
||||||
else |
|
||||||
echo "RESH INFO: New RESH shellrc script was loaded - if you encounter any issues please restart this terminal session." |
|
||||||
fi |
|
||||||
elif [ "$__RESH_REVISION" != "$(resh-session-init -revision)" ]; then |
|
||||||
# shellcheck source=shellrc.sh |
|
||||||
source ~/.resh/shellrc |
|
||||||
if [ "$__RESH_REVISION" != "$(resh-session-init -revision)" ]; then |
|
||||||
echo "RESH WARNING: You probably just updated RESH - PLEASE RESTART OR RELOAD THIS TERMINAL SESSION (resh revision: $(resh-session-init -revision); resh revision of this terminal session: ${__RESH_REVISION})" |
|
||||||
fi |
|
||||||
fi |
|
||||||
if [ "$__RESH_VERSION" = "$(resh-session-init -version)" ] && [ "$__RESH_REVISION" = "$(resh-session-init -revision)" ]; then |
|
||||||
resh-session-init -requireVersion "$__RESH_VERSION" \ |
|
||||||
-requireRevision "$__RESH_REVISION" \ |
|
||||||
-sessionId "$__RESH_SESSION_ID" \ |
|
||||||
-sessionPid "$__RESH_SESSION_PID" |
|
||||||
fi |
|
||||||
} |
|
||||||
@ -1,12 +0,0 @@ |
|||||||
FROM debian:jessie |
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget tar gcc automake make bison flex curl vim makeinfo |
|
||||||
RUN wget https://ftp.gnu.org/gnu/bash/bash-3.2.57.tar.gz && \ |
|
||||||
tar -xvzf bash-3.2.57.tar.gz && \ |
|
||||||
cd bash-3.2.57 && \ |
|
||||||
./configure && \ |
|
||||||
make && \ |
|
||||||
make install |
|
||||||
RUN echo /usr/local/bin/bash >> /etc/shells && chsh -s /usr/local/bin/bash |
|
||||||
|
|
||||||
CMD bash |
|
||||||
Loading…
Reference in new issue