File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -156,11 +156,12 @@ def make_format_info_labels(self):
156156 "notes" , "date" ,
157157 "localdate" , "time" ,
158158 "localtime" , "datetime" ,
159- "localdatetime" , "day" ,
159+ "localdatetime" , "timezone" ,
160+ "utcoffset" , "day" ,
160161 "localday" , "month" ,
161162 "localmonth" , "year" ,
162- "localyear" , "timezone " ,
163- "utcoffset " , "url" ,
163+ "localyear" , "utcnow " ,
164+ "localnow " , "url" ,
164165 "location" , "timestamp" ,
165166 "bookid" , "uuid" ,
166167 ]
@@ -182,7 +183,8 @@ def make_format_info_labels(self):
182183 self .note_format_list_labels .append (label )
183184 self .l .addWidget (label )
184185
185- time_note = QLabel ("Note that times are the time the highlight was made, not the current time." )
186+ time_note = QLabel ("Note that times are the time the highlight was made, not the current time " + \
187+ "(except 'utcnow' and 'localnow')." )
186188 self .l .addWidget (time_note )
187189
188190 def save_settings (self ):
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ def format_blockquote(text: str) -> str:
108108 h_time = datetime .datetime .strptime (annot ["timestamp" ][:19 ], "%Y-%m-%dT%H:%M:%S" )
109109 h_local = h_time + h_time .astimezone (datetime .datetime .now ().tzinfo ).utcoffset ()
110110 local = time .localtime ()
111+ utc = time .gmtime ()
111112 title_authors = book_titles_authors .get (int (data ["book_id" ]), {}) # dict with {"title": str, "authors": Tuple[str]}
112113 utc_offset = ("" if local .tm_gmtoff < 0 else "+" ) + str (local .tm_gmtoff // 3600 ) + ":00"
113114
@@ -139,6 +140,8 @@ def format_blockquote(text: str) -> str:
139140 "localmonth" : str (h_local .month ),
140141 "year" : str (h_time .year ),
141142 "localyear" : str (h_local .year ),
143+ "utcnow" : time .strftime ("%Y-%m-%d %H:%M:%S" , utc ),
144+ "localnow" : time .strftime ("%Y-%m-%d %H:%M:%S" , local ),
142145 "url" : url_format .format (** url_args ), # calibre:// url to open ebook viewer to this highlight
143146 "location" : url_args ["location" ], # epub cfi location of this highlight
144147 "timestamp" : h_time .timestamp (), # Unix timestamp of highlight time. uses UTC.
You can’t perform that action at this time.
0 commit comments