Skip to content

Commit

Permalink
show ??? when a timestamp is not known
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Mar 25, 2024
1 parent b8706dd commit 0261321
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ import org.briarproject.briar.desktop.contact.ContactItem
import org.briarproject.briar.desktop.contact.GroupItem
import org.briarproject.briar.desktop.contact.GroupPeerItem
import set_tox_online_state
import timestampMs
import com.zoffcc.applications.trifa2.timestampMs
import toxdatastore
import java.io.File
import java.io.PrintWriter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import com.zoffcc.applications.trifa.HelperOSFile.show_file_in_explorer_or_open
import com.zoffcc.applications.trifa.TRIFAGlobals
import com.zoffcc.applications.trifa.TRIFAGlobals.TRIFA_MSG_TYPE
import com.zoffcc.applications.trifa.ToxVars
import com.zoffcc.applications.trifa2.timeToString
import org.briarproject.briar.desktop.ui.Tooltip
import java.io.File
import kotlin.random.Random
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ import androidx.compose.ui.unit.sp
import com.vanniktech.emoji.emojiInformation
import com.zoffcc.applications.trifa.HelperFiletransfer
import com.zoffcc.applications.trifa.HelperGeneric
import com.zoffcc.applications.trifa.HelperGeneric.AsyncImage
import com.zoffcc.applications.trifa.HelperGeneric.loadImageBitmap
import com.zoffcc.applications.trifa.HelperOSFile.open_webpage
import com.zoffcc.applications.trifa.HelperOSFile.show_containing_dir_in_explorer
import com.zoffcc.applications.trifa.HelperOSFile.show_file_in_explorer_or_open
import com.zoffcc.applications.trifa.TRIFAGlobals
import com.zoffcc.applications.trifa2.timeToString
import kotlinx.coroutines.DelicateCoroutinesApi
import org.briarproject.briar.desktop.ui.Tooltip
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
package com.zoffcc.applications.trifa2

import java.text.SimpleDateFormat
import java.util.*


val df_date_time_long = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")

fun timeToString(timestampMs: Long): String {
return try {
df_date_time_long.format(Date(timestampMs))
try {
if (timestampMs == 0L)
{
return "???"
}
else
{
return df_date_time_long.format(Date(timestampMs))
}
} catch (e: Exception) {
"1970-02-02 12:00:01"
return "1970-02-02 12:00:01"
}
}

Expand Down

0 comments on commit 0261321

Please sign in to comment.